将每个XQuery结果放在新行上 [英] Put each XQuery result on a new line
问题描述
我有这个.xq文件:
$ $ p $ 声明默认元素命名空间http://www.w3.org/2001/XMLSchema; :)
在$ i在doc(zoo.xml)中// $ animal
return< ;李> {$ I}。 {$ X /名称/文本()}< /锂>
我得到正确的结果,但所有这些都在一行上,当我真的想要类似:
< li> 1。宙斯< /锂>
< li> 2。佛瑞德< /锂>
...
这可能吗?在此先感谢您的答案! :)
...您可以添加一个换行符作为return子句的第二部分:
(:declare default element namespacehttp://www.w3.org/2001/XMLSchema; :)
for $ x at $ i in doc(zoo.xml)// animal
return(< li> {$ i}。{$ x / name / text()}< / li> ;,'& #xa ;')
结果序列化的方式也取决于特定的XQuery处理器。
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.
这篇关于将每个XQuery结果放在新行上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!