[xml] Namespace axis fix



Hi

I've got a patch for xmlXPathNextNamespace() that fixes the problem with it
not returning the default XML namespace, and reverses the namespace axis so
that it is now in document order.

If you have any objections to changing the direction of the namespace axis,
I'll post a patch that just fixes the default XML namespace bug.

Thanks,
Richard


----- Original Message -----
From: "Richard Jinks" <cyberthymia yahoo co uk>
To: <xml gnome org>
Sent: Friday, June 21, 2002 3:28 PM
Subject: [xml] Namespace axis


Hi

In my batch of XSLT tests, I came across a couple of problems with
stylesheets using the namespace axis.

The problems are that the namespace axis appear go in the wrong direction
(i.e. reverse document order), and that if no specific namespace is
defined
for an element, then no namespace (not even the default "xml" namespace)
is
returned.
I've put a test case at the end of this email

I've narrowed the problems down to the xmlXPathNextNamespace() and
xmlGetNsList() functions. My query is that the comment for
xmlXPathNextNamespace() says that the order of the namespace axis is
"implementation-defined". I've gone through the XPath 1.0 spec, and it
says
that all axes are forward apart from ancestor, ancestor-or-self, preceding
and preceding-sibling.

Before I fix this to reverse the namespace axis (and to get it to return
the
"xml" namespace), can someone point me to a reference that suggests that
reverse order is correct? If the direction of the axis is undefined, would
anyone object to me reversing the direction of the axis?

Thanks,
Richard

Test case -
XML 195c.xml
<?xml version="1.0"?>
<XML_DATA xmlns:harry="noola">
<AAA xmlns:peach="yellow"/>
<harry:BBB/>
</XML_DATA>

C:\libxml\libxslt-1.0.18.win32\util>testxpath -i 195c.xml
"name(/XML_DATA/BBB/namespace::*[1])"
testxpath -i 195c.xml "name(/XML_DATA/BBB/namespace::*[1])"
Object is a string :

C:\libxml\libxslt-1.0.18.win32\util>testxpath -i 195c.xml
"name(/XML_DATA/AAA/namespace::*[1])"
testxpath -i 195c.xml "name(/XML_DATA/AAA/namespace::*[1])"
Object is a string : peach

C:\libxml\libxslt-1.0.18.win32\util>testxpath -i 195c.xml
"name(/XML_DATA/AAA/namespace::*[2])"
testxpath -i 195c.xml "name(/XML_DATA/AAA/namespace::*[2])"
Object is a string : harry

C:\libxml\libxslt-1.0.18.win32\util>testxpath -i 195c.xml
"name(/XML_DATA/AAA/namespace::*[3])"
testxpath -i 195c.xml "name(/XML_DATA/AAA/namespace::*[3])"
Object is a string : xml

Expected results:
name(/XML_DATA/BBB/namespace::*[1]) - xml
name(/XML_DATA/AAA/namespace::*[1]) - xml
name(/XML_DATA/AAA/namespace::*[2]) - harry
name(/XML_DATA/AAA/namespace::*[3]) - peach


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml

Attachment: namespace_axis.diff
Description: Binary data



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