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: Can one element have more than one namespaces?



> From: Jeni Tennison


> Chris explained that there can be no such thing as 'element A *in* ns
> X and Y' as an element can only ever be *in* one namespace.

Yes, I think I got that. 



> Yes, the namespace axis can be used to differentiate between nodes
> that have different namespaces *in scope*. You can match the A element
> that has namespace declarations for both X and Y with the template:

Its the finessing of 'in' vs 'in scope' that got me.



> 
> <xsl:template match="A[namespace::x and namespace::y]">
>    ...
> </xsl:template>
> 
> Note that the 'x' and 'y' (the namespace prefixes) come from the
> *source* XML document, not from the declarations in the XSLT
> stylesheet.

Yes, happy with that. The lower case x and y are the prefixes not
the actual uri.

Your example

<B>
  <A xmlns:x="X" xmlns:y="Y" />
  <A xmlns:x="X" />
</B>

this has ns declarations 'for' two ns. 
Which ns is the first A element 'in'?
Or is that a factor of the prefix used? I.e. they are in the null ns?

Your example

>You can match the A element
>that has namespace declarations for both X and Y with the template:
><xsl:template match="A[namespace::x and namespace::y]">

matches the 'ns declarations for' case, which is the one I was 
seeking.

So the subtleties appear to be differentiating between
the (single) ns an element is *in*
the (possibly multiple) ns declared *for* the element
the (possibly multiple) ns's *in scope* 
(Guess that the latter two are equivalent?)

Which leaves the 'null' ns and no ns declaration.
Equivalent?
<A xmlns:x="" />
and <A>

Regards DaveP



 

 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]