RE: [xsl] xerces2 Element type "xsl:stylesheet" must be declared

Subject: RE: [xsl] xerces2 Element type "xsl:stylesheet" must be declared
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Tue, 6 Apr 2004 08:38:02 +0100
> the begining of my stylesheet:
> 
> /<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xsl:stylesheet [
>     <!ENTITY nbsp "&#160;">
> ]>
> <xsl:stylesheet
>         version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>         
> xmlns:localization="xalan://com.neomalogic.gtp.common.localiza
> tion.Localization"
>         exclude-result-prefixes="localization">
> 
>     <xsl:output method="html" indent="yes" />/
>   .........


There's no need to recreate the html entity 'nbsp' in your stylesheet
and map it to the character reference &_#160; - just use the reference
directly.

I would suggest removing the doctype from your stylesheet and then do a
global replace of &_nbsp; to &_#160; - you will achieve the same result
but won't have to deal with the forced validation that specifying a DTD
brings.

The entity &_nbsp; is a html entity and as such is only meaningful to a
html renderer.  It means nothing to an xml parser which is why you have
to map the entity to something the parser does understand. The numerical
character reference &_#160; is a unicode codepoint and maps to a
specific character (a non-breaking-space) and can be used directly in
your stylesheet (like any character reference) and so by mapping an
entity to it your are just creating an unnecessary 'extra step' for the
parser.

(I've used underscores '_' here to ensure the references appear as
references (and not what they resolve to) you will of course want to
remove them).

cheers
andrew

Current Thread