[xsl] MSXML and name() on namespace nodes

Subject: [xsl] MSXML and name() on namespace nodes
From: Mike Brown <mike@xxxxxxxx>
Date: Sat, 17 Feb 2001 23:34:49 -0700 (MST)
I noticed what I believe is a minor bug in MSXML3.

While playing with the ASCII stylesheet viewer, I was comparing the
output from XML4J+Saxon against the output from MSXML3 in IE5, and
noticed one difference, aside from the expected whitespace stripping
that occurs in the MS DOM builder.

The name() function, when the current node is a namespace node,
returns in MSXML3 'xmlns' or 'xmlns:someprefix', whereas in Saxon
it returns just '' or 'someprefix'. I believe Saxon is correct and
MSXML3 is in error.

Quoting XPath 1.0, section 4.1,

"The name function returns a string containing a QName representing 
the expanded-name of the node [...] An implementation may include 
information about the original prefix in its representation of
nodes; in this case, an implementation can ensure that the returned
string is always the same as the QName used in the XML source"

...This make me think yeah, MSXML is allowed to tell us what was
in the source XML, and I guess that in the case of namespace nodes,
seeing the 'xmlns' would be OK.

*But* right after that paragraph, XPath says:

"NOTE: The string returned by the name function will be the same as
the string returned by the local-name function except for element
nodes and attribute nodes"

So, when we combine that with this:

"A namespace node has an expanded-name: the local part is the
namespace prefix (this is empty if the namespace node
is for the default namespace); the namespace URI is always null"

then it follows that local-name() would return for a namespace
node just the namespace prefix or an empty string, and that the
NOTE above would mean that name() cannot return the 'xmlns'...
thus MSXML3 is in error.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at            My XML/XSL resources: 
webb.net in Denver, Colorado, USA              http://skew.org/xml/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread