Hi,
I think that the problem you are having is that the position function
does not work the way you want it to. It can access a node in a
specific position relative to the context node, e.g.:
oid_xpath_string(oid_caret(),'para[position()=2]')
returns the content of the second para child of oid_caret().
But you can't just get a numeric position() of the current node in
relation to it's parent by calling the position() function on the
current node. Essentially the square brackets are giving the position
function the evaluation context that it needs.
If I correctly guessed your intention (which is unlikely) then you
might find that this does what you need quickly and correctly:
oid_xpath_string(oid_caret(), 'count(preceding-sibling::*)')
or
oid_xpath_string(oid_caret(), 'count(preceding-sibling::YourTag)')
if you want to know how many of element X occur before the current
node. Just remember to add 1 to the result if you want it to index
from 1 the way the position() function does.
Cheers,
Dugald
Quoting Paul Nagai <->:
> Hiya,
>
> I'm having trouble with oid_xpath_string. As my subject line says, I can't
> get oid_xpath_string($oid,'position()') to return anything other than 0.
> Anyone have a clue what's going on? I *can* call the same system-func from
> my FOSI, pass $oid back to the FOSI, and express what appears to be a real
> OID so I have the FOSI and the server-side ACL wired properly.
>
> XPATH has bitten me before, so I'm probably missing some subtlety of
> something or other. This just proves it: I get 0 everytime I issue
> response(oid_xpath_string(oid_caret(),'position()')) from the Editor command
> line. What am I missing?
>
> Hi, Ed.
>
> --
> Paul Nagai
>