Re: [xsl] Element type "xsl:stylesheet" must be declared

Subject: Re: [xsl] Element type "xsl:stylesheet" must be declared
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 10 Dec 2003 20:57:03 GMT
> I understand the above answer.  Maybe this is a different issue, but I don't
> understand the following entity declaration--from the example "Main
> stylesheet" in Dave Pawson's "XSL-FO":
>    <?xml version="1.0"?>
>    <!DOCTYPE xsl:stylesheet [
>    <!ENTITY sp "<xsl:text> </xsl:text>">
>    ]>
>    <xsl:stylesheet
>        ...
Normally white space nodes in a stylesheet are dropped so you can indent
your xsl:template instructions without putting white space in the
result, so if you want to force a space then you need to go
<xsl:text> </xsl:text>
as xsl:text is the one place where white space is not dropped.
If you are doing this a lot you could define the entity above
and just use &sp; this will expand out to the xsl:text element
before xslt starts, and so will result in a single space in the result.

Personally I wouldn't do that as it makes it hard to see what are the
white space nodes in

In order to understand the stylesheet you have to expand the entity "in
your head" in which case it's probably easier to have used
<xsl:text> </xsltext> instead of &sp;. But it's a matter of personal

If you get an error from that it probably _is_ the same problem that
I mentioned: the parser is defaulting to validating mode in which case
your stylesheet will error on xsl:stylesheet as that element is not
declared in the DTD (not surprising as the DTD doesn't declare any
elements, and just declares one entity. Your system may be able to be
forced to use non-validating mode, or if not edit the stylesheet to
remove the doctype and replace every &sp; by <xsl:text> </xsl:text>


 XSL-List info and archive:

Current Thread