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