Re: [xslt] Bug when declaring entities?



On Tue, Sep 17, 2002 at 01:05:43PM -0400, Paul Tremblay wrote:
> I think I have found a bug in xsltproc. 
> 
> If I put the follwing in my stylesheet:
> 
> <!DOCTYPE stylesheet [
> <!ENTITY nbsp "<xsl
> disable-output-escaping='yes'>&amp;nbsp;</xsl>">
> ]>
> 
> I get the following error:
> 
> compilation error: file /home/paul/Documents/data/xsl_style_sheets/finalConvertTei.xsl line 2 element text
> Namespaces prefix  used for multiple namespaces

  I don't think it's what you actually have in your stylesheet.
but :
  <!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">

  otherwise your entity declaration makes no sense and libxslt would
not generate an error since there is no namespace used in the entity !

> The code in my stylesheet is taken directly from a book on xslt. If I

  that's theorically fine but if you do

  <foo xmlns:xsl="bar">&nbsp;</foo>
  <foo xmlns:xsl="err">&nbsp;</foo>

your &nbsp; reference would lead to different namespaces for the element
text and in 99% of the case you don't want this so my parser complain about
it.
Simply define the namespace in the entity:

  <!ENTITY nbsp "<xsl:text xmlns:xsl="..." disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">

 then it becomes context insensitive and libxml2 won't complain.
Anyway using "disable-output-escaping" is bad practice in general...

> run the same code with xalan, I don't get an error. 

  They are just a bunch of losers :-)
More seriously we have different appreciation of some of those suble issues.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]