RE: [xsl] Why no namespace node KindTest?

Subject: RE: [xsl] Why no namespace node KindTest?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 26 Aug 2006 21:38:17 +0100
> Because namespace nodes are deprecated, and a compliant 
> processor need not support them.

Not strictly true in the case of XSLT. Every processor is required to
support the following:

<xsl:variable name="x" as="node()">
  <xsl:namespace name="xs">http://www.w3.org/2001/XMLSchema</xsl:namespace>
</xsl:variable>

<xsl:if test="$x instance of ?????">...

What is true, however, is that if you don't support the namespace axis then
you never need to expose a namespace node that's attached to an element,
which means you don't get into the XPath 1.0 issues of namespace node
identity.

(The background on this is that people realized that namespace nodes were a
lot more expensive than they needed to be because they had separate identity
and separate parents, which makes it impossible for different elements to
share namespace nodes. Since there are no known use cases for namespace
nodes where the identity and parentage actually matter, use of the namespace
axis was deprecated and replaced by the functions in-scope-prefixes and
namespace-uri-for-prefix. XQuery is written as if namespace nodes don't
exist, even though they are defined in the data model, because XQuery never
exposes them. XSLT however relies on namespace nodes to support dynamic
namespace construction using xsl:namespace.) 

Michael Kay
http://www.saxonica.com/

Current Thread