Reputation: 163
There is a string. I want to check whether there is a character after the digit or not.
Input:
<root>
<information id="fig-FigF.3A"/>
</root>
Output should be:
<root>
<!--xxx-->
</root>
tried code:
<xsl:template match="root/information">
<xsl:choose>
<xsl:when test="substring-after(@id,'\d') = '\c'">
<xsl:comment>xxx</xsl:comment>
</xsl:when>
<xsl:otherwise>
<xsl:comment>yyy</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
But my tried code, not workes as I expected. How can I do this?
I am using XSLT 2.0
Upvotes: 0
Views: 59
Reputation: 116959
I think you want to do:
<xsl:when test="matches(@id, '\d\D')">
This looks for a pattern of digit followed by a non-digit.
Upvotes: 1