RE: [xsl] Can one element have more than one namespaces?

Subject: RE: [xsl] Can one element have more than one namespaces?
From: DPawson@xxxxxxxxxxx
Date: Tue, 27 Mar 2001 09:13:34 +0100
> From: Christopher R. Maden [mailto:crism@xxxxxxxxx]


> An element has one, and exactly one, name.
> 
> That name has a namespace URI and a local part.
> 
> The namespace part may be null, if there is no prefix and no default 
> namespace in scope.  This example has no namespace URI and a 
> local part of 
> "foo":
> 
> <foo xmlns=""/>
> 
> The namespace part may be a URI.  In both of these examples, 
> the URI is 
> "http://crism.maden.org/consulting/example-namespace"; and the 
> local part is 
> "foo":
> 
> <foo xmlns="http://crism.maden.org/consulting/example-namespace"/>
> <ex:foo 
> xmlns:ex="http://crism.maden.org/consulting/example-namespace"/>
> 
> Now, this is getting confused with the namespace declarations 
> in scope.  An 
> element only ever has one namespace.  But more than one namespace 
> *declaration* may be in scope for that element.  In these 
> examples, the 
> element has the namespace 
> http://crism.maden.org/consulting/example-namespace and a 
> local part of 
> "foo", but there are two namespace declarations in scope:
> 
> <ex:foo xmlns:ex="http://crism.maden.org/consulting/example-namespace";
>    xmlns="http://crism.maden.org/consulting/example-namespace-2"/>
> <foo xmlns="http://crism.maden.org/consulting/example-namespace";
>    xmlns:ex="http://crism.maden.org/consulting/example-namespace-2"/>
> 
> These elements are of the same type.
> 
> In XPath 1.0, you must use a prefix to match an element type with a 
> URI.  In XSLT, the way to bind that prefix to a URI is to 
> have namespace 
> declarations in scope in the XML document that is the stylesheet:
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>    xmlns:ex="http://crism.maden.org/consulting/example-namespace";>
> 
> <xsl:template match="ex:foo"/>
> 
> </xsl:stylesheet>
> 
> That template matches *all* of the foo elements given above, 
> except the 
> first one (which has no namespace URI).
> 
> Clearer?

So the answer is no? I can't differentiate between the two elements
in my example, since the only difference is the 'extra namespace in scope',

Can't the namespace axis be used for this purpose?

Regards DaveP
(Only a little clearer Chris ;-)

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


Current Thread