I can't find the exact answer for this question so I hope someone will help me here.
I have a string and I want get the substring after the last '.'. I'm using xslt 1.0.
How is this done? This is my code.
<xsl:choose>
<xsl:otherwise>
<xsl:attribute name="class">method txt-align-left case-names</xsl:attribute> 
<xsl:value-of select="./@name"/> // this prints a string eg: 'something1.something2.something3'
</xsl:otherwise>
</xsl:choose>
When i paste the suggested code I get an error message. "Parsing an XSLT stylesheet failed."
I can't think of a way to do this with a single expression in XSLT 1.0, but you can do it with a recursive template:
Result:
I resolved it
Did not need the
in the template call
I did the same behaviour with a xsl:function - usage is then a little bit simpler:
And you can call it directly in a value-of:
Here is a solution using EXSLT str:tokenize:
(the
if
is here because if your string ends with the separator, tokenize won't return an empty string)