字符串长度查找重复节点的长度
我的 xml 看起来像
<details>
<addr>
<streetAddressLine>90822 abc lane</streetAddressLine>
<streetAddressLine>apt b</streetAddressLine>
<!-- streetAddressLine element is repeatable -->
<state>xyz</state>
</addr>
</details>
我正在寻找 xpath 表达式,它可以给我 string-length(streetAddressLine[0]) + string-length (streetAddressLine[1]) + ..... + string-length(streetAddressLine[n) 的长度])
My xml looks like
<details>
<addr>
<streetAddressLine>90822 abc lane</streetAddressLine>
<streetAddressLine>apt b</streetAddressLine>
<!-- streetAddressLine element is repeatable -->
<state>xyz</state>
</addr>
</details>
I am looking for xpath expression which can give me the length of string-length(streetAddressLine[0]) + string-length (streetAddressLine[1]) + ..... + string-length(streetAddressLine[n])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在我们知道您需要 XPath 2.0 解决方案,此表达式:
结果:
对于 XSLT 1.0 解决方案,此样式表:
输出:
Now that we know you want an XPath 2.0 solution, this expression:
Result:
For a XSLT 1.0 solution, this stylesheet:
Output: