Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML output via an XSL transform involving special characters
    primarykey
    data
    text
    <p>I am having trouble transforming particular characters from an XML feed into XHTML.</p> <p>I am using the following example to demonstrate the problem.</p> <p>Here is my XML file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;paragraph&gt;some text including the –, ã and ’ characters&lt;/paragraph&gt; </code></pre> <p>Here is the XSLT I am applying:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="html" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /&gt; &lt;xsl:template match="paragraph"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;p&gt;&lt;xsl:apply-templates/&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Here is the resultant XHTML:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;p&gt;some text including the –, ã and ’ characters&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The characters from the original XML are being replaced with new ones.</p> <p>Firstly I want to check whether there is something wrong with my encoding which causes this issue?</p> <p>Am I supposed to do something using entities if I want to map the special characters to display correctly in XHTML? If so how do I use these within an XSLT and do I need to know every single possible value that could be in my XML feed in advance?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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