Reputation: 81
I have a single XSLT file which will transform all input to other XML. Here my challenge is that how to preserve the DTD from the input XML. For example, assume a.xml uses "x.dtd" and b.xml used "y.dtd". When I get the result-document how to preserve the input XML document DTD declaration.
By the below approach, I get the static DTD in all resulted document.
<xsl:output method="xml" indent="no" doctype-system="some.dtd" doctype-public="somepath" name="xml"/>
Upvotes: 0
Views: 543
Reputation: 163488
You can't do this in standard XSLT, but you can do it using Andrew Welch's LexEv utility (which I believe is integrated in KernowForSaxon, available from SourceForge). LexEv works by turning the DTD, or at least the DOCTYPE declaration, into an XML representation which can then be transformed or retained through the transformation, before being turned back into DTD syntax afterwards.
Upvotes: 0