XML : XPATH select multiple values

I have the following xml file:

  <a ida="1">      <b>data</b>      <c idc="1">          <d>data</d>          <e ide="1">              <f>data</f>          </e>          <e ide="2">              <f>data</f>          </e>      </c>  </a>    <a ida="2">      <b>data</b>      <c idc="2">          <d>data</d>          <e ide="3">              <f>data</f>          </e>          <e ide="4">              <f>data</f>          </e>      </c>  </a>    

I want to retrieve via XPATH the b element as well as all the e childs of c with their f element.

To do something like this with XQUERY:

  xquery version "3.0";  for $x in doc("file.xml")//a//c//e  order by $x//f ascending  return <res>{$x/../../b, $x//f}</res>    

In XPATH i can only select one element:

doc("askhsh.xml")//a//c//e//f

No comments:

Post a Comment