This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Attributes, attribute nodes & namespaces


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:

  ../namespace::*

rather than:

  namespace::*

What benefit would you get from having namespace nodes on attributes
too?

Cheers,
  
Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]