【发布时间】:2022-01-05 12:07:42
【问题描述】:
我正在使用 concat 函数编写 Xpath 脚本以使用 XPath 1.0 以行显示结果
XML 示例
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XPath
concat("To : ", /note/to , ' \n ', "From : ", /note/from, ' \n ', "Heading : ", /note/heading, ' \n ', "Body : ", /note/body)
结果
To : Tove \n From : Jani \n Heading : Reminder \n Body : Don't forget me this weekend!
但是,当我使用带有两个元素和“\n”之间的 concat 时,它可以正常工作。
xPath:
concat("To : ", /note/to , ' \n ', "From : ", /note/from)
结果:
To : Tove
From : Jani
【问题讨论】:
-
使用 而不是 \n
-
很遗憾,它并没有解决问题
-
向我们展示您的 XSLT 代码。仅仅添加一个标签是不够的。
-
我用的是Infor M3 ERP系统所以我们得到路径,然后字符串结果从“字符串到二维码”转换
-
我不知道 Infor M3 ERP 系统是什么。请提供minimal reproducible example。
标签: string xpath concatenation xslt-1.0 xpath-1.0