Subject: Re: [xsl] possible to use copy-of without namespace From: Thomas Brand <brand@xxxxxxxxx> Date: Wed, 08 Jan 2003 11:38:07 +0100 |
At 2003-01-08 05:03 +0100, Thomas Brand wrote:i try to get a 1:1 copy of a tree (using xsl:copy-of) without having the xmlns attribute set in the root node of the result tree.
http://www.w3.org/TR/xslt#copy-of says "copying an element node copies the attribute nodes, namespace nodes and children of the element node as well as the element node itself"
Is there a possibility to avoid the xmlns attribute added?
Yes, by recreating each node found in the source instead of using xsl:copy-of.
But why is it important to you that an unused xmlns attribute is hanging around?
Your test file is very confusing, though, because your <somechildnode> construct isn't an element ... it is inside of PCDATA. The element before is in the ans namespace and the one following isn't ... since you are using the ans namespace in the result, you will need it.
<xsl:template mode="copy-no-ns" match="*"> <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="copy-no-ns"/> </xsl:element> </xsl:template>
Greets from Berne, Thomas Brand
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] possible to use copy-of w, G. Ken Holman | Thread | Re: [xsl] possible to use copy-of w, G. Ken Holman |
[xsl] format number mask, Joeri Belis | Date | [xsl] How do I create an FO index f, Graham Hannington |
Month |