[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Can DOCTYPE survive transformation

Subject: Re: Can DOCTYPE survive transformation
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 21 Jun 2006 13:17:18 -0400
tif doctype
Hi Rick,

At 11:53 AM 6/21/2006, you wrote:
I have an xml document with a doctype and some entity references as shown below. Is there a way to have them carry through to my output document? Thanks in advance.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UpdateNote SYSTEM "file:///C:/Program%20Files/Adobe/FrameMaker7.2/structure/UpdateNoteAPP/UpdateNote.dtd" [


<!-- Begin Document Specific Declarations -->

<?Fm Validation Off?>

<!NOTATION tif SYSTEM "TIF">
<!ENTITY TN SYSTEM "file:///G:/marketing/framemaker/xml/imgUpdate/TN.tif" NDATA tif>


<!-- End Document Specific Declarations -->

]>

Unfortunately, the answer is "not really". XSLT works on a parsed representation of the input file, the "tree", in which no entities are present and no signs are left that there ever were entities.


Frequently, when people face this requirement they resort to non-XSLT workarounds. These include things like escaping the entities with a pre-process (so that &entity; comes out as &amp;entity; etc.), and unescaping them as a post-process, or similar tricks and techniques.

XSLT 2.0 does support better control of the serializer than XSLT 1.0, including character maps, so as long as you are happy to get your references normalized, that may also be an option.

Your sample, however, shows not entity references but an entity *declaration* in the DTD internal subset (and it's an unparsed entity). This is a different kettle of fish (though perhaps no more palatable). A post-process to drop this chunk of code into the output is probably the way to go ... or if your transformation is serialized immediately, you could resort to tag-writing using disable-output-escaping (assuming your processor supports it), and write the entire DOCTYPE declaration as a string literal.

At least in the past, Saxon has also had extension functions to work around this limitation. If you're using Saxon you should look into it.

Ask again if you need more details.

Cheers,
Wendell

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.