Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatically converting escaped characters to string literals
    text
    copied!<p>I am working on an XSLT transformation to re-arrange XML blocks to validate NewsML files. Some of these files contains encoded characters (such as &amp;amp; &amp;quot; etc...). The problem is the XSLT transformation is converting these characters to their literal string (ie "and", "'"). This is causing problems. I do not want this to happen.</p> <p>I have experimented with various techniques (uses of &lt;xsl:text&gt;, &lt;xsl:value-of&gt; and the disable-output-escaping flag, &lt;xsl:output method='xml|html|xhtml|text'&gt;) to no avail. These methods either, convert the characters, or simply leave them out.</p> <p>eg, a string which starts with "stars on PM&amp;amp;apos;s cards" can end up as</p> <ul> <li>stars on PM's cards</li> <li>stars on PMs cards</li> </ul> <p>I am using the Saxonica (<a href="http://www.saxonica.com/" rel="nofollow noreferrer">http://www.saxonica.com/</a>) processing app.</p> <p>The basic XSLT I am using is provided below. (There are other things but the problem exists even with this simplest stylesheet)</p> <pre><code>&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" indent="no" /&gt; &lt;xsl:template match="@*|node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Any ideas on how to prevent this conversion would be most appreciated. The requirement is to keep the original text as it appears.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload