Hello,

first af all i know my question is more about general xquery than sedna 
itself, so if that's again the rules of this list please let me know and 
then in the future i'll stick to strictly sedna related dicussion here. 
Now the question :) I have an xml document like this:

<shopData>

<products>
<product uid="1">
<name>Knife</name>
<categories>
<category id="20" />
</categories>
</product>
<product uid="2">
<name>Soap</name>
<categories>
<category id="21" />
</categories>
</product>
<product uid="3">
<name>Toner</name>
<categories>
<category id="30" />
</categories>
</product>
</products>

<categories>
<category uid="10">
<name>Home</name>
<subCategories>
<category uid="20"><name>kitchen</name></category>
<category uid="21"><name>bathroom</name></category>
</subCategories>
</category>
<category uid="30">
<name>Office</name>
</category>
</categories>

</shopData>

is there a way in a single flwor expression to get the following products:

- all products which are for "Home" category - so where the 
product/categories/category/@uid is a descendant or self of the category 
where /shopData/categories/category/@uid=10?
- get all the products of a category with uid=X, if we don't know how 
deep the /shopData/categories/ node is, and where in that hierarchy the 
category with uid=X is? So i guess first i need to find the descendants 
of this category (which has uid X), and then compare that againts the 
/shopData/products/product/categories/ nodes' category childrens' uid 
attributes.

If this is not possible in a single flwor query, could somebody tell me 
a nice "xquery-ish" way to solve similar problems? Am i right that for 
such questions fn:descendant() and fn:ancestor and fn:ancestor-or-self 
is the way to go?

thanks, Gabor



------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to