Thanks you very much. I use very often the comment() with XSLT, and I confuse it with the "comment" literal of XQuery ! Marc
Le 07/08/2019 à 19:22, Majewski, Steven Dennis (sdm7g) a écrit :
Also literal <!— XML comments —> work just like other literal XML, as there is a different syntax for (: XQuery comments :)
XQuery: <comments> <!-- more comments... --> { collection()[1]//comment() } { comment { " last comment " } }</comments> (: XQuery Comment :)
Produced output:
<comments> <!-- more comments... --> <!-- xmlns="http://www.tei-c.org/ns/1.0" namespace removed and root element TEI => TEI.2 to conform to DTD based TEI stylesheets --> <!-- Real PID: <idno type="uva-pid" >uva-lib:2826790</idno> Fake PID: --> <!-- FIXME: figure on p116 & 117: no image and table missing from transcription --> <!-- FIXME: figure on p116 & 117: no image and table missing from transcription --> <!-- last comment --> </comments>
"comment()" is the XPath syntax to match a comment node, not a function that creates comments.
— Steve M.
On Aug 7, 2019, at 1:03 PM, Martin Honnen martin.honnen@gmx.de wrote:
On 07.08.2019 18:52, Marc wrote:
I want to write a comment in the xml I produce with my XQuery. I try to use the comment() function, but each time I want to put something inside the () i have a syntax error.
If you want to create a comment node computed by an expression use comment { expression }
see https://www.w3.org/TR/xquery-31/#doc-xquery31-CompCommentConstructor
So comment { $r } seems to be what you want to do.