Subject: Re: [xsl] possible to use copy-of without namespace From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 08 Jan 2003 03:33:30 -0500 |
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?
<somenode> <somechildnode>childvalue1</somechildnode> </somenode>
<anothernode> <anotherchildnode>anotherchildvalue1</anotherchildnode> </anothernode>
T:\ftemp>type a.xsl <?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ans="http://www.someurl.com/a" exclude-result-prefixes="ans" version="1.0">
<xsl:template match="ans:mydoc"> <xsl:element name="result"> <xsl:copy-of select="ans:anode"/> <xsl:apply-templates mode="copy-no-ns" select="somenode/node()"/> <xsl:apply-templates mode="copy-no-ns" select="anothernode"/> </xsl:element> </xsl:template>
<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>
</anothernode> </result> T:\ftemp>
-- Upcoming hands-on in-depth North America: February 3- 7,2003 XSLT/XPath and XSL-FO Europe: February 17-21,2003
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-10-1 Practical Formatting Using XSL-FO Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] possible to use copy-of witho, Thomas Brand | Thread | Re: [xsl] possible to use copy-of w, Thomas Brand |
RE: [xsl] Max size?, Edward . Middleton | Date | RE: [xsl] writing xsl for processin, Andrew Welch |
Month |