This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Removing namespaces from source document (long)


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: msg00255/pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]