Reputation: 157
I am very new to XSLT and need to grab only the last letter of an XML value and add that character to my HTML output.
Upvotes: 6
Views: 21611
Reputation: 29032
Use the XPath expression
substring(., string-length(.), 1)
or, in an XSLT way
<xsl:value-of select="substring(., string-length(.), 1)" />
This works, because XPath starts counting at 1 and not 0.
Upvotes: 17