Jiang, Peiyun wrote:
I have a document that has a doctype with public ID , system ID and an
internal subset of DTD.
When I do XLST translation with xml output and specify System ID and public
ID:
<xsl:output method="xml"
doctype-public="...."
doctype-system="...."
indent="no"
encoding="ISO-8859-1" />,
the internal subset of DTD is lost in the output document.
Is this expected behavior? Is there a way to keep the internal subset of
DTD?
As others have said, there's no way to preserve arbitrary input internal
DTD subsets using XSLT alone. However, it is easy to write a SAX program
to copy the internal subset.
Why do you need the internal subset in this case? I can only think of
two reasons that you would need an internal subset in this case:
1. You are redeclaring parameter entities in order to tailor the
external declarations specifically for the document instance.
2. You are generating entity references in the output document and need
to declare the entities.
If you are doing case (1) I'd be interested to know why you're doing it.
If you are doing case (2), then if you have enough information to
generate entity renference you probably have enough information to
generate the declarations for those entities.
If you're trying to preserve the input entity structure in the output
document, XSLT is the wrong tool. You should probably be using something
like a SAX process where you have direct access to all aspects of the
input document, including the internal subset and all entity references.
Cheers,
Eliot
--
W. Eliot Kimber
Professional Services
Innodata Isogen
9030 Research Blvd, #410
Austin, TX 78758
(512) 372-8122
eliot(_at_)innodata-isogen(_dot_)com
www.innodata-isogen.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list