在 XPath 1.0 中,如何测试长度为 1 的字符串是否在其他两个代码点之间?
给定包含这些标签的文档,我如何判断是否“” < “H”<文档编码中的“z”?我正在尝试在 XPath 1.0 中执行此操作。
<text>H</text>
<range>
<from> </from>
<to>z</to>
</range>
我什至可以摆脱使用 contains() 的麻烦,但是如何创建一个包含从“”到“z”的字符的字符串来进行测试呢?
Given a document containing these tags, how can I tell whether " " < "H" < "z" in the document's encoding? I'm trying to do this in XPath 1.0.
<text>H</text>
<range>
<from> </from>
<to>z</to>
</range>
I might even be able to get away with using contains(), but then how would I create a string containing the characters from " " through "z" to test against?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此转换查找某个 ascii 字符是否在任意两个 ascii 字符的(含)范围内:
应用于以下 XML 文档时(恰好包含所提供的 XML 片段) :
产生想要的结果:
应用于此 XML 文档时:
再次产生正确的结果:
This transformation finds if an ascii character is in the (inclusive) range of any two ascii characters:
when applied on the following XML document (that contains exactly the provided XML fragment):
produces the wanted result:
When applied on this XML document:
again the correct result is produced:
我认为 XPath 1.0 不可能做到这一点。 2.0 中使用的是 fn:compare 函数: http://www. w3.org/2005/xpath-functions/#compare
我无法尝试,但我猜 XPath 会是:
I don't think it's possible with XPath 1.0. It is with 2.0, though using the fn:compare function: http://www.w3.org/2005/xpath-functions/#compare
I'm not able to try it out but I guess the XPath would be: