如何在 XQuery string-join() 中包含空格
let $text :=
<a>
<b>f</b>
<b>a</b>
<b> </b>
<b>l</b>
</a>
return
string-join($text/b,"")
产生“fal”而不是“fa l”
let $text :=
<a>
<b>f</b>
<b>a</b>
<b> </b>
<b>l</b>
</a>
return
string-join($text/b,"")
yields "fal" rather than "fa l"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
string-join
将包含空格,但构造函数可能根据 边界空间。对于“strip”的设置,您看到的结果是正确的,您可以有效地构造一个没有任何边界空白的节点,即:
您可以通过将此声明添加到查询序言中来强制保留边界空间:
string-join
will include spaces, but the constructor may have dropped them according to the effective setting of boundary space.The result that you are seeing would be correct for a setting of "strip", where you effectively are constructing a node without any boundary whitespace, i.e.:
You can enforce keeping boundary space by adding this declaration to the query prolog: