是否存在类似于SQL或模糊搜索的XSL?
例如:
<xsl:for-each select="foo[foo_type like '%1%']">
最佳答案
使用(在 select
属性中)标准 XPath 函数 contains()
如以下 XPath 表达式:
foo[contains(foo_type, '1')]
根据具体情况,下面列出的其他标准 XPath 函数也可能有用:
请注意 ends-with()
、matches()
、tokenize()
和 replace()
仅在 XPath 2.0 中可用。
可以使用以下 XPath 1.0 表达式来实现与 XPath 2.0 函数 ends-with()
相同的目的:
substring($s, string-length($s) - string-length($target) +1)
=
$target
相当于:
ends-with($s, $target)
关于xslt - XSL之类的还是模糊搜索?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7167721/