Hi all,
I have the following XML document:
<?xml version="1.0"?>
<!DOCTYPE root [
<!ENTITY x "hello">
]>
<root>
<a>&x; world</a>
</root>
(here I am using an internal DTD subset to define custom entities)
[1] I want to write a transform which prevents entity expansion. For
e.g. the output of transform should be (this is an identity
transform):
<?xml version="1.0"?>
<!DOCTYPE root [
<!ENTITY x "hello">
]>
<root>
<a>&x; world</a>
</root>
(I think generating the !DOCTYPE declaration (for entity declaration)
in output is necessary to have declaration of the entity 'x').
If I write the identity transform as:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I get the output:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<a>hello world</a>
</root>
But I want the output as specified in [1] above.
What is the solution to this problem? I can use XSLT 2.0.
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--