Re: [xsl] Attributes, attribute nodes & namespaces

Subject: Re: [xsl] Attributes, attribute nodes & namespaces
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 4 Jul 2001 09:55:30 +0100
Hi Andrew,

> If an attribute node can have a QName and an expanded-name why does
> (or so it seems to me) an XPath attribute node not have a namespace
> node to correspond to the namespace?

First, remember that namespace nodes aren't about what the namespace
of a particular element or attribute is, but rather about what
namespaces are in scope on a particular element.  Getting the
namespace of an element or attribute can be done with the
namespace-uri() function.

Now, the only thing that changes whether a namespace is in scope is if
you have a namespace declaration on an element. You cannot have a
namespace that is only in scope for a particular attribute. So the
namespace nodes for an attribute must be exactly the same as the
namespace nodes for its parent element.

Given that, why bother storing all that extra information about the
namespaces that are available on an attribute? The only cost of not
doing so is that the location path to get the namespaces that are in
scope for an attribute are three characters longer:


rather than:


What benefit would you get from having namespace nodes on attributes


Jeni Tennison

 XSL-List info and archive:

Current Thread