名前空間接頭辞 foo と bar を使った xml 文書があります.
----------
<foo:root xmlns:foo="http://foo-namespace" xmlns:bar="http://bar-namespace">
 <bar:e1>this is <foo:e2>a</foo:e2> pen. </bar:e1>
</foo:root>
----------
これを以下の xslt に食わせて,
foo に属する要素を全て bar の要素に変換します.
----------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:foo="http://foo-namespace" xmlns:bar="http://bar-namespace" version="1.0">
<xsl:output indent="yes" omit-xml-declaration="yes" />
<xsl:template match="foo:root"><bar:root><xsl:apply-templates select="*" /></bar:root></xsl:template>
<xsl:template match="foo:e2"><bar:e2><xsl:value-of select="." /></bar:e2></xsl:template>
<xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy></xsl:template>
</xsl:stylesheet>
----------
すると,以下のような xml 文書 (多少整形してあります) が得られるのですが,
----------
<bar:root xmlns:bar="http://bar-namespace" xmlns:foo="http://foo-namespace">
 <bar:e1>this is <bar:e2>a</bar:e2> pen.</bar:e1>
</bar:root>
----------
結果として全く使われていない foo に対する宣言が文書に含まれてしまいます.
exclude-result-prefixes="foo" を指定しても,bar:e1 要素に宣言が現れるだけで意味がありませんでした.
これを取り除く (最適化?) することはできないのでしょうか.
いや,実害はないんですけど気持ち悪くて...