2 xquery problems
1:
If i have some xml in the form
<root>
<a>hello</a>
<b>
<bi>hiya</bi>
<bii>hey</bii>
</b>
<c/>
<d>hello again</d>
</root>
how can I
a) count the nodes? i.e. a, b, bi, bii, c, d so 6
b) count the nodes that are non empty a, bi, bii, d so 4
?
2:
if i search for a string/substring in an xmldata type and it is found in one or more places, how can i get its position back?
e.g. if i search for hi (i.e. in hiya) how can i get my query to return 2,1 - 2(the second node of the root), 1(the first node of the second node or the root node)
?
## Deliverables
an optimized query if possible that will be as fast as possible if possible