Re: Removing namespaces from source document (long)
I have some (unused) namespace declarations in my source xml document that I want to banish.
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format