[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
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
|
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
|