Re: Where can I find the XSLT DTD?

Subject: Re: Where can I find the XSLT DTD?
From: Joe English <jenglish@xxxxxxxxxxxxx>
Date: Thu, 03 Feb 2000 13:28:33 -0800
David Carlisle <davidc@xxxxxxxxx> wrote:
>
> It is _impossible_ to write a dtd that covers every xsl stylesheet as
> they may include arbitrary elements from the target DTD. So you have
> to define the result-elements entity to list any result elements
> that may appear inside an xsl element and then add all possible result
> elements to the dtd. Normally it isn't worth the bother, noone uses
> validating parsers to read xsl stylesheets do they?


Not while processing them, no, but to validate them
beforehand, sure!

Validators usually give better error messages than XSLT processors,
which is helpful for catching gross structural errors.

Plus, in cases where the stylesheet makes heavy use of literal
result elements, this can go a long way towards semantically
validating the stylesheet (that is, making sure that the
stylesheet produces valid result documents).

However, constructing a DTD against which to validate the
stylesheet in this case can be a bit tricky.  It's usually
not hard to customize the XSLT DTD fragment:

    <!ENTITY % xsl.dtd SYSTEM "xslt.dtd">
    <!ENTITY % html.dtd PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/dev/null">
    %html.dtd;
    <!ENTITY % result-elements "%inline; |  %block;" >
    %xsl.dtd;

but the target DTD *also* has to be parameterized in order to allow
XSL instructions inside literal result elements!  This isn't
difficult either if you "cheat" and use an SGML parser for
validation; inclusion exceptions fit the bill nicely here.


--Joe English

  jenglish@xxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread