XSL like or fuzzy search?
Use ( in the select
attribute) the standard XPath function contains()
as in following XPath expression:
foo[contains(foo_type, '1')]
Depending on the concrete case, other standard XPath functions, as listed below, may also be useful:
starts-with()
ends-with()
substring()
substring-before()
substring-after()
string()
string-length()
concat()
translate()
normalize-space()
matches()
replace()
tokenize()
Do note that ends-with()
, matches()
, tokenize()
and replace()
are available only in XPath 2.0.
One can use the following XPath 1.0 expression for the same purpose as the XPath 2.0 function ends-with()
:
substring($s, string-length($s) - string-length($target) +1)
=
$target
is equivalent to:
ends-with($s, $target)
Not exactly, but you have a lot of string functions, as contains
, starts-with
, etc. You can see MS' documentation on these functions here:
http://msdn.microsoft.com/en-us/library/ms256195.aspx
Your particular select would be something like:
<xsl:for-each select="*[contains(name(),'1')]">