This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Unwanted (default) namespaces.
- From: "David N Bertoni/Cambridge/IBM" <david_n_bertoni at us dot ibm dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 8 Jul 2002 17:10:58 -0700
- Subject: Re: [xsl] Unwanted (default) namespaces.
- Reply-to: xsl-list at lists dot mulberrytech dot com
> You're right; that's how I was propogating the <html:br/> tag forward. I
> have to confess that namespaces are the one area of XSL (I'm currently
> aware of) that I really don't have a handle on, so if you don't mind, I'd
> like to "kick the dead horse" a bit.
>
> In the source XML document, the <html:br/> tag is completely qualified.
> Why is the choice being made to associate an additional (the default)
> namespace with this node? This seems like it will cause problems in
> environments in which components from multiple namespaces are being
> integrated. Does this mean we shouldn't define default namespaces in
> situations involving multiple namespaces? I don't understand why that
> node is being associated with a namespace other than what it was
> explicitly referenced by. Could you describe what aspect/rule
> associated with the XSL transformation causes this additional namespace
> to be associated with that node?
It's not a "choice," and it's not additional. If a namespace is in scope,
it's in scope. Hopefully, you'll agree that if I declare a namespace bound
to a particular prefix, that namespace is in scope in that subtree:
<foo:bar xmlns:foo="http://foo.com">
<foo:bar/>
</bar>
The default namespace is no different (other than in does not apply to
attributes):
<bar xmlns="http://foo.com">
<foo2:bar xmlns:foo2="http://foo2.com"> <!-- The default namespace,
"http://foo.com", is in scope here -->
<bar/> <!-- In the namespace "http://foo.com" -->
</foo2:bar>
</bar>
That being the case, the XSLT recommendation requires that when you copy a
node, all the in-scope namespace nodes be copied to the result tree.
You need to understand the XPath data model. The particulars regarding
namespace nodes are here:
http://www.w3.org/TR/xpath#namespace-nodes
The particulars for xsl:copy are here:
http://www.w3.org/TR/xslt#copying
Hope that helps...
Dave
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list