|
Subject: RE: [xsl] [Fwd: Excluding unused and duplicate namespace declarations] From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 19 Mar 2007 10:19:27 -0000 |
> If you transform something with XSLT 2.0, you can set
> exclude-result-prefixes="#all" on the main xsl:stylesheet or
> xsl:transform element, which will remove all namespace
> declarations that are unused.
No, that will only stop new namespaces being added...
If you want to remove existing namespaces, try:
<xsl:template match="/">
<xsl:copy-of select="." copy-namespaces="no"/>
</xsl:template>
Or if you want to do this in the course of a transformation, use a modified
version of the identity template:
<xsl:template match="*">
<xsl:element name="name()" namespace="namespace-uri()">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
Of course, this may also remove namespaces that are in fact used, if they
are only used "in content" as distinct from being used in element and
attribute names.
Michael Kay
http://www.saxonica.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] [Fwd: Excluding unused an, Abel Braaksma | Thread | [xsl] What's your visual metaphor f, John Horner |
| Re: [xsl] Creating Nested Structure, David Carlisle | Date | Re: [xsl] Excluding unused and dup, Ryan Puddephatt |
| Month |