子节点用逗号分隔字符串和Xpath?

Cin*_*god 4 xml xpath

我有这样的XML:

<node1>
 <item>hello</item>
 <item>world</item>
</node1>
Run Code Online (Sandbox Code Playgroud)

我希望这使用XPath表达式输出以下内容:

hello, world
Run Code Online (Sandbox Code Playgroud)

XPath 1.0有可能吗?我一直在四处寻找但却找不到任何东西.

谢谢,Cinegod

Mar*_*nen 10

XPath 2.0可以做到string-join(/node1/item, ', ').使用XPath 1.0你不能这样做,你需要使用像XSLT这样的宿主语言或暴露XPath API的过程语言来迭代节点并连接值.