Is it possible to put each XQuery result on a new line? I thought I remembered there was an attribute to set at the beginning of the document, but can't remember. :/
I have this .xq file:
(: declare default element namespace "http://www.w3.org/2001/XMLSchema"; :)
for $x at $i in doc("zoo.xml")//animal
return <li>{$i}. {$x/name/text()}</li>
I get correct results, but all of them are on a single line, when I really want something like:
<li>1. Zeus</li>
<li>2. Fred</li>
...
Is this possible? Thanks in advance for your answers! :)
...you can add a newline string as second part of the return clause:
(: declare default element namespace "http://www.w3.org/2001/XMLSchema"; :)
for $x at $i in doc("zoo.xml")//animal
return (<li>{$i}. {$x/name/text()}</li>, '
')
The way how results are serialized also depends on the specific XQuery processor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With