Re: [xsl] Re: implements-prefix vs implements-namespace

Subject: Re: [xsl] Re: implements-prefix vs implements-namespace
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 6 Mar 2001 13:06:16 +0000
Hi David,

> If you need to have a namespace dec that doesn't correspond to
> any element or attribute name in the result, but to a QName (typically,
> and Xpath) in (say) an attribute value.
>
> If you've just written out
> <foo select="x:bar"/>
> as a literal result template, you might need to copy a namespace
> node with name x to ensure the output has a binding for that prefix.

Yes - my first instinct was 'copy them', my second 'copy them from a
namespace declaration on the xsl:stylesheet element because then
they're always there' and then I realised 'but if you've declared them
already then they're copied automatically'. Naturally, my reasoning
may be faulty - I don't think it says anywhere explicitly that the
namespace prefixes on the copied namespace nodes have to stay the
same?

I do think it's fairly good practice to declare a namespace if you use
it anywhere (even within an attribute value). So I'd write the above:

  <foo select="x:bar" xmlns:x="http://www.baz.com"; />

(or more probably declare the namespace on the xsl:stylesheet element
to get it to be in scope throughout the document).

Interestingly, I wonder if this is an argument for doing:

<xsl:element name="my:foo" xmlns:my="http://www.foo.com"; />

rather than:

<xsl:element name="my:foo" namespace="http://www.foo.com"; />

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread