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

Subject: Re: [xsl] xerces2 Element type "xsl:stylesheet" must be declared
From: Othman HADDAD <ohaddad@xxxxxxxxxxxxxx>
Date: Tue, 06 Apr 2004 10:30:06 +0200
hi again,
i'm sory the solution you proposed works fine,but is there any other way to declare &nbsp; without using /<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;">
]> ?


/because replacing &nbsp; with &#160; isn't very professionnal and practical,i have too many stylesheets and a lot of poeple that work with html are used to use &nbsp; ..
thank you for your answer.
othman
/
/


Othman HADDAD wrote:

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