I need to make an statement where the test pass if there is just one asterisk in a string from the source document.
Thus, something like
<xslt:if test="count(find('\*', @myAttribute)) = 1)>
There is one asterisk in myAttribute
</xslt:if>
I need the functionality for XSLT 1, but answers for XSLT 2 will be appreciated as well, but won’t get acceptance unless its impossible in XSLT 1.
In XPath 1.0, we can do it by removing all asterisks using
translateand comparing the length:In XPath 2.0, I’d probably do this: