RE: [xsl] Moving an element to a new location in the Result-tree

Subject: RE: [xsl] Moving an element to a new location in the Result-tree
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Wed, 7 Sep 2005 17:38:51 -0700 (PDT)
Jim Graves writes:
> Yes, I'm probably am thinking in a procedural manner, more than
> 50%/time.
> Please let me clarify my problem with more details:
> Let's suppose my source document looks like this: (note: repeating "b1"
> elements)
> I want to move the former "b1" elements down the tree and re-name them
> (all) along the way,

Here is the key.  You arent moving or renaming anything.

You are creating an entirely new document.  It may or may not bear any
resemblance to the input document.

Think in those terms, and you will achieve victory! (-:

Heres a transformation.  Its just the identity transform, but the
children of document1 arent processed in document order.

<xsl:transform version="1.0"

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

<xsl:template match="document1">
    <xsl:apply-templates select="*[not(self::b1)]"/>
    <xsl:apply-templates select="b1"/>


Christopher R. Maden, Principal Consultant, crism consulting
<URL: >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA

Current Thread