Re: DOCTYPE handling in XML

mirod <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Peter T Cash wrote:
> For what it's worth, this appears to be a general limitation of XML tools. 
> I've been writing XSLs and running them with the Saxon parser; I ran into 
> the same problem. There's apparently no way to get an XSL transform to 
> process an XML document and preserve ENTITY declarations. This appears to 
> be a side effect of the fact that the parser won't copy the DOCTYPE 
> declaration to the output, and the ENTITY declarations are part of the 
> DOCTYPE. 
> 
> You can get the transform to output a doctype declaration with the 
> doctype-public or doctype-system attributes of the xsl:output statement, 
> but that's not the same as copying what's there--you won't get the ENTITY 
> declarations. 
> 
> The workaround, of course, is to use a Perl program to just pfutz around 
> with your output files (get the declarations from the original document, 
> and stick them to the front of the XSL output). If you're writing the 
> whole thing in Perl to begin with, that's easy, of course. (My manager had 
> a thing about Perl, and insisted I just use straight XSLs and DOS batch 
> files...until we ran into stuff like this. Heh heh...)
> 
> Petr, We've been using NDATA etc. also to declare image files as entities; 
> I'll have to look into XLink...but I'm not sure that the whole mess of 
> tools we've got cobbled together will support any given protocol (e.g. 
> Xlink). That's the Xtrouble with the whole Xworld...the Xtools never seem 
> to quite do what's Xneeded. 
> 
> Peter
> Petitioning the W3C to deprecate the letter "X" since 1998.

XML::Twig will happily preserve entity declarations, and even let you manipulate 
them.

I use XML for publishing, so I still use DTDs, and XML::Twig tends to work 
nicely with them.

-- 
mirod
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.