Re: [xsl] XPath attribute namespace

Subject: Re: [xsl] XPath attribute namespace
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Aug 2001 09:31:07 +0200 (MEST)
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=""; xlink:href="">.
> 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

Hope that helps,

|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW: |

 XSL-List info and archive:

Current Thread