This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Where can I find the XSLT DTD?



David Carlisle <davidc@nag.co.uk> 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@flightlab.com


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]