tags:

views:

84

answers:

1

For, example, there is an xml:

<article-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="3.xsd">
    <article section="physics">
     Increasing linear dynamic range of commercial digital photocamera
     <author>M. V. Konnik</author>
     <content>
      Methods of increasing linear optical dynamic range
     </content>
    </article>

my aim is to query string content of article element. I.e.:

Increasing linear dynamic range of commercial digital photocamera

The obvious solution like this:

<!--xquery-->
{
for $article in doc("name.xml")//article-list/article
    where $article/receiving-date > xs:date("2005-01-01")
    return
     <article>
      {$article}
     </article>
}

Returns whole article tree, not only a string.

A: 

$article is an element, not a node. To get the text (the text you want is actually the text child node of the $article node), you just need:

 {$article/text()}
Brabster
Thank you it worked!
skfd
np glad to help, thanks for accepting.
Brabster