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

Re: Removing namespaces from source document (long)

Subject: Re: Removing namespaces from source document (long)
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Sun, 07 Apr 2002 16:43:29 -0700
removing document templates automatically
At 15:46 7/4/02, Stephen Ng wrote:
I have some (unused) namespace declarations in my source xml document that I
want to banish.

But if I do:

<xsl:template match="/">
  <xsl:apply-templates mode="copy"/>
</xsl:template>

plus her template, I get the same results:  bad-ns is still declared.  Am I
misunderstanding her example?

I think so. XSLT 1.0 §7.5 says:


The xsl:copy element provides an easy way of copying the current node. Instantiating the xsl:copy element creates a copy of the current node. The namespace nodes of the current node are automatically copied as well, but the attributes and children of the node are not automatically copied. The content of the xsl:copy element is a template for the attributes and children of the created node; the content is instantiated only for nodes of types that can have attributes or children (i.e. root nodes and element nodes).

So when you copy <root>, the namespace nodes for "good" and "bad" are copied along with it. Your later attempt is the right approach, though I'm as surprised as you that re-creating a namespaced element is this difficult. It really ought to be possible to copy a document using <xsl:element> and <xsl:attribute>, but that doesn't seem to be the case.


~Chris
--
Christopher R. Maden, Principal Consultant, crism consulting
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA

Attachment: pgp00000.pgp
Description: PGP signature

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-2011 All Rights Reserved.