Subject:Accessing the document context of a node that is in a sequence Author:Lee Humphries Date:21 Sep 2005 02:10 AM
OK, next XQuery question.
I have a hierarchical document, with various instances of the same element occurring at various levels. I need to process each of these elements in turn and perform differing behaviour based on their context within the hierarchical document.
So for instance:
for $Seg in //Seg[ancestor-or-self::*/@status != 'X']
return
<Seg @id="{@id}" @status="{@status}">
{
if ($Seg/following::*[@status = 'M' or @status = 'R']) then
(: do required behaviour :)
else
(: do nothing :)
}
</Seg>
The problem with above code snippet is that the 'following::' axis is applied relative to the sequence of tuples produced by the for clause, whereas I need it to be relative to the node in its original context within the document.
What's the correct way to approach this situation?
Subject:Accessing the document context of a node that is in a sequence Author:(Deleted User) Date:21 Sep 2005 01:24 PM
Hi Lee,
the following:: axis should always work on the DOM tree, not on the sequence created by FLWOR block. Can you modify your query to print out the nodes, in order to verify if the fault is in the XPath query?