HorusKol
HorusKol

Reputation: 8706

How does one copy document specific DTD during XSL transformation?

I have the following document specific DTD at the top of an XML file created by our editing software:

<!DOCTYPE front SYSTEM "file:///M:/Library/AMH-Paed.dtd" [
<!NOTATION cgm PUBLIC "" >
<!-- Begin Document Specific Declarations --><!ENTITY fm.tcont " (Continued)">
<!ENTITY equation1 SYSTEM "equation11.cgm" NDATA cgm>
<!ENTITY equation2 SYSTEM "equation26.cgm" NDATA cgm>
<!ENTITY equation3 SYSTEM "equation32.cgm" NDATA cgm>
<!ENTITY equation4 SYSTEM "equation41.cgm" NDATA cgm>
<!ENTITY equation5 SYSTEM "equation51.cgm" NDATA cgm>
<!ENTITY equation6 SYSTEM "equation62.cgm" NDATA cgm>
<!-- End Document Specific Declarations -->]>

We're updating the general doctype for our content, and so transforming the current XML files through XSLT.

We have a couple of hundred documents, but only a handful of them have any specific declarations (which vary in number, name, and value) which we have to maintain through the transformation.

However, I can't find a way to maintain the above entity declarations through the transformation.

Is it possible, and how would you do it?

Upvotes: 1

Views: 129

Answers (1)

Michael Kay
Michael Kay

Reputation: 163332

DTD declarations aren't part of the data model presented to the XSLT processor so this can't be done directly.

A workaround is to use the Lexev tool from Andrew Welch. This converts the DTD into an XML representation as a pre-processing step, and then does the reverse as a post-processing step.

Upvotes: 1

Related Questions