[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: possible to use copy-of without namespace

Subject: Re: possible to use copy-of without namespace
From: Thomas Brand <brand@xxxxxxxxx>
Date: Wed, 08 Jan 2003 11:38:07 +0100
copy of unused namespace

Hi Ken,


your solution with the template mode=".." is exactly what I was looking for, thanks indeed!!

At 03:33 08.01.2003 -0500, you wrote:
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?

well, the guidelines for the output format are very strict. i guess one could also let them hang around maybe.. :) there is a little chance that the delivered customer gets confused about it.


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.

absolutely. the use of CDATA was a bloody workaround, which now has been corrected thanks to better knowledge!


i'll have to read about templates with mode attributes, never saw them.

<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


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.