xslt text transformation and special characters

<oXygen/> general issues.
jolla
Posts: 1

xslt text transformation and special characters

Thu May 12, 2016 6:17 pm

I transform an XML document to text. Sometimes it has for example < in the text wich arrives as &lt;
But I want to keep this as &lt; in the text output.
If I do nothing it comes out as <.
If I try to change it to &amp;lt; it comes out as that.
adrian
Posts: 2451

Re: xslt text transformation and special characters

Fri May 13, 2016 12:35 pm

Hi,

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

If you want &lt; 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="&lt;" string="&amp;lt;"/>
    </xsl:character-map>

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 1 guest