Re: [xslt] Bug(?) in xmlns handling



On Thu, Nov 16, 2006 at 12:31:56PM -0500, Jonathan S. Shapiro wrote:
> This may well be an error in our usage, so I hesitate to post a bug
> report without confirming. There has been a change in behavior beginning
> with the fedora libxslt-1.1.18-1 package, but it is likely that our
> input has always been wrong and it is simply getting "caught" now (which
> is good).
> 
> Problem: We have an XSLT transformer that used to work (but may have
> been incorrect). It is emitting an SVG tree using the XML output method,
> and it is trying to wrap part of the output in a namespace tag by doing:
> 
>      <xsl:element name="svg">
>        ...
> ==>     <xsl:attribute name="xmlns:svg">
>          <xsl:text>http://www.w3.org/2000/svg</xsl:text>
>        </xsl:attribute>
> 
> Beginning with 1.1.18-1, we get an error at the line indicated by the
> "==>".
> 
>   compilation error: file ../../../../doc/doctools/XSLT/sbox-svg.xsl
>     line 47 element attribute
>   xsl:attribute: The prefixed QName 'xmlns:svg' has no namespace binding
>     in scope in the stylesheet; this is an error, since the namespace
>     was not specified by the instruction itself.
> 
> [lines broken for readability]
> 
> I'm not clear if this is a bug in libxslt or if it is a but in our
> transform script.

 The latter I guess:
   http://www.w3.org/TR/xslt#creating-attributes

  "XSLT processors may make use of the prefix of the QName specified
   in the name attribute when selecting the prefix used for outputting
   the created attribute as XML; however, they are not required to do
   so and, if the prefix is xmlns, they must not do so. Thus, although
   it is not an error to do:

   <xsl:attribute name="xmlns:xsl"
   namespace="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute>

   it will not result in a namespace declaration being output."

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]