RE: [xsl] How to copy all child elements except specific one?

Subject: RE: [xsl] How to copy all child elements except specific one?
From: "Morris, Chris" <ChrisM@xxxxxxxxxxxxxxxx>
Date: Wed, 17 Jan 2001 09:20:55 -0600
> Oh, so all you need is this:
> <xsl:stylesheet xmlns:xsl="";
>                 version="1.0"
>                 >
> <xsl:template match="*|/">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
> <xsl:template match="ChildElementToChange">
> <xsl:copy>
> <NewElement>
>  <xsl:copy-of select="../@L3Attr|@*"/>
> <xsl:apply-templates/>
> </NewElement>
> </xsl:copy>
> </xsl:template>
> </xsl:stylesheet>
> David

First off, thanks so much for your help, David. I'm learning a whole lot
through this process.

I accidently left off one additional tweak, so the above is almost what I
need. Here's my latest, thanks to your xsl diet plan in your previous post

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xsl:output method="xml"/>

<xsl:template match="@*|node()">
    <xsl:apply-templates select="@*|node()"/>

<xsl:template match="Level3">
    <xsl:copy-of select="@*[not(attribute::L3Attr)]" />  <!-- *this line not
working* -->
    <xsl:copy-of select="*[not(self::ChildElementToChange)]" />
    <xsl:apply-templates select="ChildElementToChange" />

<xsl:template match="ChildElementToChange">
      <xsl:attribute name="L3AttrRenamed"><xsl:value-of select="../@L3Attr"
      <xsl:copy-of select="@OldValue|@NewValue" />


- I need to remove the L3Attr attribute from the Level3 element
- I need to rename the L3Attr when it's moved into NewElement

What's Not Working:
- removing the L3Attr attribute. How can I get this to work?

BTW, why does your identity transform look different from mine (which I
believe is the w3 spec)?

 XSL-List info and archive:

Current Thread