[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Can DOCTYPE survive transformation
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. 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 &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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|