title: How to retain special characters after transformation?
body: <p>I am working on XML transformation using XSL in Java program. This is the sample XML</p>
  
  <pre><code>&lt;root&gt;
   &lt;head&gt;Heading goes here&lt;/head&gt;
   &lt;middle&gt;Some text goes here&lt;/middle&gt;
   &lt;body&gt;Body goes here &amp;#x2019; with special characters&lt;/body&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The XSL has identity template and it just removes a <code>&lt;middle&gt;</code> element. </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:output method="xml" indent="yes" encoding="UTF-8"/&gt;
    &lt;!-- the identity template --&gt;
    &lt;xsl:template match="@* | node()" name="identity"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="@* | node()" /&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  
  &lt;!-- template to remove middle element --&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>The transformation is done through Java program (Transformer class). After transformation, <code>&amp;#x2019;</code>in the body is converted to &#x2019; char. I want to retain the <code>&amp;#x2019;</code> instead of &#x2019; char. Please let me know how to achieve this?</p>
  
  <p>Thank you in advance.</p>