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

Re: Moving elements of place

Subject: Re: Moving elements of place
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 12 Mar 2003 23:07:34 -0700 (MST)
xslt moving elements
beatrizlangiano wrote:
> Hi, I need to make a stylesheet to transform XMI files.
> I need to remove some elements that are children of the  
> <XMI.content>, and put them after this element is 
> closed. (after </XMI.content>)

This is the third time today that we've suggested this:

Use the identity transform, as discussed in the XSLT spec under Copying:

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

This will result in a recursive copy of all nodes.

Add to it a template that matches the nodes you want to treat specially:

  <xsl:template match="XMI.content">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()[not(self::foo)]"/>
    </xsl:copy>
    <xsl:apply-templates select="foo"/>
  </xsl:template>

In this case, you're excluding the 'foo' element chilren of the 'XMI.content'
element from being processed until after the copy of the XMI.content element
is made.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 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.