If your XML has been parsed using LexEv, here are some sample templates for handling the LexEv markup.
To output an entity reference:
<xsl:template match="lexev:entity">
<xsl:value-of disable-output-escaping="yes" select="concat('&', @name, ';')"/>
</xsl:template>
To process a CDATA section as markup:
<xsl:template match="lexev:cdata">
<xsl:apply-templates/>
</xsl:template>
To output a DOCTYPE from the processing instructions:
In XSLT 1.0 the doctype-public and doctype-system attributes on xsl:output
are static and need to be known at compile time, which means I'm afraid you have to do this:
<xsl:template match="/">
<xsl:value-of disable-output-escaping="yes"
select="concat('<!DOCTYPE ', name(/*), '
 PUBLIC "',
processing-instruction('doctype-public'), '" "',
processing-instruction('doctype-system'), '">')"/>
<xsl:apply-templates/>
</xsl:template>
In XSLT 2.0 you can use xsl:result-document
where the doctype-public and doctype-system are AVTs which mean their values can be determined at runtime:
<xsl:template match="/">
<xsl:result-document
doctype-public="{processing-instruction('doctype-public')}"
doctype-system="{processing-instruction('doctype-system')}">
<xsl:apply-templates/>
</xsl:result-document>
</xsl:template>