W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2004

how to write such xquery?

From: Chen Yabing <iscp0054@nus.edu.sg>
Date: Fri, 5 Mar 2004 20:29:24 +0800
Message-ID: <3630B143EA0D7246BDF7EF9FBDF6F9ABAB4492@MBXSRV26.stu.nus.edu.sg>
To: <www-ql@w3.org>
Suppose I have a document as follows:

 

<a ano="a001">

   <b bno="b001">

       <c cno="c001"/>

       <d dno="d001"/>

       <d dno="d002"/>

   </b>

   <b bno="b002">

       <c cno="c002"/>

       <d dno="d002"/>

   </b>

</a>

 

I would like to write a query to retrieve those elements from top to
down that has sub element <d> whose dno = "d002". That is, I want the
result like this:

 

<a ano="a001">

   <b bno="b001">

       <c cno="c001"/>

       <d dno="d002"/>

   </b>

   <b bno="b002">

       <c cno="c002"/>

       <d dno="d002"/>

   </b>

</a>

 

How to write such a query in a simple XQuery? Can I use filter function?

Thanks in advance.
Received on Friday, 5 March 2004 07:29:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:19 GMT