[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




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