Reputation: 19147
This is some XML:
<Test>This is some text</Test>
<Test>This is some text:</Test>
<Test>This is some text :</Test>
Using XSL 1.0 is it possible to get the value and trim from the right any " " and ":" character?
Thank you.
Upvotes: 1
Views: 77
Reputation: 12075
Here's a quick & dirty way:
<xsl:template match="Test/text()">
<xsl:value-of select="normalize-space(translate(.,':',''))"/>
</xsl:template>
This will cause problems for any elements that have a : or double spaces in the middle or a leading space, but if you don't have anything like that, it should work.
This removes any colons by replacing them with nothing, then does 'normalize-space', which trims trailing, leading and double spaces from text.
Upvotes: 1