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: XPath attribute namespace


Hi David,

> I don't understand why the XPath spec says:
> 
> "the namespace axis contains the namespace nodes of the context node; the 
> axis will be empty unless the context node is an element"
> 
> How do you get to the namespace for an attribute node? For example 
> <url xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="www.xxx.com">.
> It seems like the namespace in this case is associated with the attribute
> and not the element. How should I interpret this?

Every element and every attribute has a qualified name. This is a name
composed of a local name and a namespace. And of course, there is only
one namespace per name. 
On the other hand all namespaces are associated with prefixes. This allows
you writing xlink:href, because xlink refers to a namespace. The set
of associations between prefixes and namespaces establishes a set of
namespace nodes. These belong per definition to an element node.

So don't be confused. The namespace axis allows you to retrieve all
namespaces that are "in scope" for that element. The namespace-uri function,
as Dimitre already pointed out, tells you the namespace the node belongs
to.

Hope that helps,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


 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]