Re: [xslt] Should I be loading DTDs?



On Thu, Aug 19, 2004 at 04:14:25PM -0700, David Hyatt wrote:
> I asked for some good XSLT test cases on my blog, and one of the ones 
> presented to me can be found here.
> 
> http://astro.nickshanks.com/library/extrasolar.xml
> 
> The author pointed out that he had a link to an external DTD that 
> defined entities, and suggested that the DTD should be loaded.  I'm 
> basically looking for suggestions as to what the "correct" default 
> behavior should be for Safari.  Should I tell libxml to load the 
> external DTDs by default when parsing XSL stylesheets and XML docs that 
> do transforms?

  Yes, the parser options you should use to be compliant at the tree
level with the XPath data model are XSLT_PARSE_OPTIONS, which is a 
shortcut for 

XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA

  i.e.:
    - load the external subset
    - substitute entities
    - expand DTD defaulted attributes
    - pass CDATA sections a normal text nodes
 
 you will probably have to play with libxml2 I/O (xmlIO.h) to get the
DTD loaded.

The good XSLT case will be when you manage to format some DocBook documentation
on the fly without loss of formating and with decent speed. This may be a 
challenge especially with DocBook very complex DTDs and stylesheets.
And for XSLT test case there is a few hundreds in libxslt tests subdir,
including DocBook...


Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]