Project

Profile

Help

saxon:evaluate signature

Added by Anonymous about 17 years ago

Legacy ID: #4563287 Legacy Poster: James Fuller (cutlass)

I am away from home puter and have restricted net access .... can someone help me with this newbie question? e.g. I would like to apply a dynamic xpath using saxon:evaluate let $a := <test><c>true</c></test> let $b := "//c" return $a/saxon:evaluate($b) I am getting a 050: The root of the tree containing the context item is not a document node which is of course due to how I am declaring the $a .... can someone remind me, whilst I do not have access to my brain (e.g. google) ta, Jim Fuller


Replies (2)

RE: saxon:evaluate signature - Added by Anonymous about 17 years ago

Legacy ID: #4563405 Legacy Poster: James Fuller (cutlass)

figured it out, without google ;) let $v :=document{<test><c>true</c></test>} return $v/saxon:evaluate("//c") cheers, Jim Fuller

RE: saxon:evaluate signature - Added by Anonymous about 17 years ago

Legacy ID: #4563688 Legacy Poster: Michael Kay (mhkay)

The other solution would be to use the expression .//c or root()//c. But I think there's probably less risk of going wrong if you always put a document node at the top of your trees - and it also means you are more likely to benefit from join optimizations, since Saxon will only build an index for a tree (as distinct for a transient sequence) if the tree is rooted at a document.

    (1-2/2)

    Please register to reply