I need to query an XML file for obtaining:
1) the total number of "/root/div" elements and the position
2) the position of the one with text() = "very"
The logic should pass through the file one one time (not two) for speed reason since it's a very long file, so could be this:
FIND ALL DIVS USING XPath(/root/div), ASSIGN TO x
VAR i = 0
VAR v = -1
LOOP THROUGH ALL x
INCREMENT COUNTER i
IF x' EQUALS 'very' AND v EQUALS -1
v = i
Is it some feasible with an XQUERY?