for example, i want 3 chars trimmed from the right of a string or up to and including a comma in the string (this will always be 3 chars including the comma though)
You can get the length of a string with the string-length() function - and you have three ways of grabbing parts of a string, by way of the substring(), substring-before() and substring-after() functions, so here's how to attack the "trim last 3 chars" scenario:
<xsl:variable name="demoString" select="'1234,67'" />
<!-- Grab the the substring from #1 to #(length - 3) -->
<xsl:variable name="trimmed" select="substring($demoString, 1, string-length($demoString) - 3)" />
Trim value of page item in XSLT
is it possible to trim a page item in XSLT?
for example, i want 3 chars trimmed from the right of a string or up to and including a comma in the string (this will always be 3 chars including the comma though)
Thanks!
Hi Roger,
You can get the length of a string with the string-length() function - and you have three ways of grabbing parts of a string, by way of the substring(), substring-before() and substring-after() functions, so here's how to attack the "trim last 3 chars" scenario:
/Chriztian
Thanks again Chriztian, That works perfectly!
Roger
is working on a reply...