Strange... if you declared "x" as an entity, why do you want to output it as it's represented as entity reference?
Before starting the transformation process, the XSLT processor resolves all entity references (also makes some other preparing activities) and then creates internal tree. From that point the processor has no control over the original XML doc, so you have to care about this issue yourself. The simplest solution(though not stable and "dangerous") is to use disable-output-escaping attribute of xsl:value-of.
First of all, change the XML source to
Code:
<?xml version="1.0" ?>
<!DOCTYPE message SYSTEM "sample.dtd">
<message>
<approved flag="true"/>
<signature>Chairperson <![CDATA[&x;]]> PhD</signature>
</message>
then this stylesheet will output what you want:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="signature">
<xsl:copy>
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
So, to do strange things, the way also must be strange!
Regards,
Armen