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

RE: xslt: Wrapping multiple elements in a parent eleme

Subject: RE: xslt: Wrapping multiple elements in a parent element
From: David Neary <David@xxxxxxxxx>
Date: Fri, 9 May 2003 09:40:58 +0200
RE:  xslt: Wrapping multiple elements in a parent eleme

De : Steven Curry [mailto:scurry1@xxxxxxx]
> I need to do an xml to xml transformation where I take 1 or 
> more elements of 
> a certain name (they are grouped together somewhere in the 
> hierarchy) and 
> wrap them in a new parent element.  The rest of the document 
> should stay the 
> same.  Any xslt suggestions?  I'm sure there is any easy 
> solution but I 
> haven't found it yet.

Hi Steve,

Use the identity transformation for all elements except the ones you're
interested. That is, 

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

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

Cheers,
Dave.

 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.