Page 1 of 1

xslt text transformation and special characters

Posted: Thu May 12, 2016 6:17 pm
by jolla
I transform an XML document to text. Sometimes it has for example < in the text wich arrives as <
But I want to keep this as < in the text output.
If I do nothing it comes out as <.
If I try to change it to &lt; it comes out as that.

Re: xslt text transformation and special characters

Posted: Fri May 13, 2016 12:35 pm
by adrian
Hi,

You can control the output from the XSL.
If you use <xsl:output method="xml"/> you will get '<', otherwise, if it's "text", you'll get the actual character, '<'.

If you want < no matter what, you can use a character map.

Code: Select all

    <xsl:output method="text" use-character-maps="mymap"/>
<xsl:character-map name="mymap">
<xsl:output-character character="<" string="&lt;"/>
</xsl:character-map>
Regards,
Adrian