Re: [xslt] name function



On Thu, Jul 05, 2001 at 11:27:54PM -0500, Charlie Bozeman wrote:
> My stylesheet is a modification of the docbook stylesheet with
> "chunking". When the stylesheet is trying to determine if an element is
> chunk, the test fails because the name of the node (using name(.)) does
> not match the expected name. My xml file and stylesheet use a default
> namespace so the name function returns something like (null):foo. I
> wrote a simple example to illustrate.
[...]
> while xsltproc gives:
> name=(null):doc
[...]
> With xt the name and local-name are the same but in xsltproc name has
> "(null)" as the prefix.

     Nice bug !

  I fixed it in CVS:

 before

orchis:~/XSLT/tests/general -> xsltproc bug-50-.xsl ../docs/bug-50-.xml 
<?xml version="1.0"?>

     
success
name=(null):doc
local-name=doc

orchis:~/XSLT/tests/general -> 

 after

orchis:~/XSLT/tests/general -> xsltproc bug-50-.xsl ../docs/bug-50-.xml 
<?xml version="1.0"?>

     
success
name=doc
local-name=doc

orchis:~/XSLT/tests/general -> 

> It wasn't clear from the spec what the result of
> the "name" function should be. Is this a problem with xt, xsltproc, or
> should I be using "local-name" instead?

  http://www.w3.org/TR/xpath#function-name

  " The QName must represent the name with respect to the namespace
  declarations in effect on the node whose name is being represented.
  Typically, this will be the QName that occurred in the XML source."

 And in this case the element is in the default namespace, there is no
prefix and that was just a libxml bug, and a vicious one since it would
have led to crashes of the libc don't check for NULL string in snprintf.

  thanks a lot for the bug report,

Daniel

P.S.: patch is http://cvs.gnome.org/bonsai/cvsquery.cgi?module=gnome-xml&branch=HEAD&branchtype=match&dir=gnome-xml&file=&filetype=match&who=veillard&whotype=match&sortby=Date&hours=&date=explicit&mindate=07%2F08%2F01+10%3A27&maxdate=07%2F08%2F01+10%3A27&cvsroot=%2Fcvs%2Fgnome

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Sep 17-18 2001 Brussels Red Hat TechWorld http://www.redhat-techworld.com




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