Re: [xslt] Bug? xsltPrecomputeStylesheet() puts ns on root node without checking for conflict



On Sun, Jun 17, 2012 at 09:02:01AM -0400, Noam Postavsky wrote:
> When libxml2 is configured --with-run-debug, xsltproc on the following
> stylesheet complains "Reference to namespace 'n' not in scope". This
> appears to be because xsltPrecomputeStylesheet() is moving excluded
> namespaces to the root node, even if the root node already contains a
> definition for that namespace prefix (xslt.c, line 3531).
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>                 xmlns:n="ns" exclude-result-prefixes="n"
>                 version='1.0'>
>   <xsl:template match="/"  xmlns:n="ns"/>
> </xsl:stylesheet>
> 
> Perhaps it's okay because the namespace definitions aren't consulted
> after this? At any rate I can't produce any symptoms apart from the
> debug print.

  You you are right, libxslt will mess up the stylesheet tree at
compilation (it owns it so it's legal !) and in that specific case
it does something that the debug checking doesn't like, but that's
okay it should be safe :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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