Re: [XQuery] 3.7.3.1 Sample query is wrong

Hello Alberto,
Yes, you are right. This is embarrassing. I will fix this example in the 
next version of the document.
Thanks for your helpful comment!
--Don Chamberlin




Alberto Massari <amassari@progress.com> 
Sent by: public-qt-comments-request@w3.org
09/14/2004 08:38 AM

To
public-qt-comments@w3.org
cc

Subject
[XQuery] 3.7.3.1 Sample query is wrong







In the computed element constructor section, there is this sample query

"Here is an example entry:

<entry word="address">
    <variant lang="German">Adresse</variant>
    <variant lang="Italian">indirizzo</variant>
</entry>

[...]


element
     {$dict/entry[word=name($e)]/variant[lang="Italian"]}
     {$e/@*, $e/*}
"

The XPath expression should have "@word" and "@lang" instead of "word" and 

"lang".
Also, the expression $e/* will not select the text fragment, as it is 
(according to 3.2.1.2) the abbreviated form for $e/child::* and so it will 

return only element nodes.

The right query would be

"
element
     {$dict/entry[@word=name($e)]/variant[@lang="Italian"]}
     {$e/@*, $e/node()}
"

Alberto

Received on Tuesday, 14 September 2004 16:37:52 UTC