Re: [xsl] Extensions and namespace output

Subject: Re: [xsl] Extensions and namespace output
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 15 Aug 2001 17:39:46 +0100
Hi Heiko,

> do I read XSLT 1.0 Standard, 7.1.1 correctly, that if a namespace
> designates an extension, its namespace is not copied to output
> elements?

Yes-ish.  If you have:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:foo="my.extension.url"
                extension-element-prefixes="foo">

<xsl:template match="/">
  <doc>...data...</doc>
</xsl:template>

</xsl:stylesheet>

then you should get:

  <doc>...data...</doc>

*However*, just because you say that an element is used as the prefix
for extension elements or should be excluded from the result (with
exclude-result-prefixes) doesn't necessarily mean that the namespace
will not be present in the result. It just means that it won't be
included when you create an element with xsl:element or with a literal
result element.

So if you have source XML like:

<doc xmlns:foo="my.extension.url">...data...</doc>

and then you *copy* that doc element with xsl:copy or xsl:copy-of,
then the my.extension.url namespace *will* appear in the result.

To get round that, you have to 'copy' the element using xsl:element
or a literal result element instead.

Cheers,

Jeni

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


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


Current Thread