Re: [xsl] Identity Transform and Default Templates, I think...

Subject: Re: [xsl] Identity Transform and Default Templates, I think...
From: "Schneeman, Brent" <BSchneem@xxxxxxxxxxx>
Date: Wed, 19 Jun 2002 12:06:13 -0700
Me again. As I was moving my lessons learned over to the real application, I
noticed that I need a bit more flexibility...

Given this input:

<C3PO>
   <SOUL id="anewmachine">The Soul</SOUL>
   <BD id="foo">
      <HEAD>The Head</HEAD>
      <TR>
         <RF>The Right Foot</RF>
         <RK>The Right Knee</RK>
         <HR>The Heart</HR>
         <Ext id="extid"><ANewLimb>Some new Limb</ANewLimb></Ext>
         <AnotherNewLimb>Another New Limb</AnotherNewLimb>
      </TR>
   </BD>
</C3PO>

I'd like to have the AnotherNewLimb element copied to the Torso element of
the output document as a sibling of Extension, Chest and RightLeg. But, I'd
like to be able to not be tied to the element name, much like I can rename
SOUL and HEAD and still get the node copied.

If I add 

	<xsl:apply-templates/>

to the TR template, I wind up applying the RF, RK, HR and Ext templates
twice - the output looks like this:

<SeeThreePO>
   <SOUL id="anewmachine">The Soul</SOUL>
   <Body id="foo">
      <HEAD>The Head</HEAD>
      <Torso>
         <Chest>
            <Heart>The Heart</Heart>
         </Chest>
         <RightLeg>
            <RightFoot>The Right Foot</RightFoot>
            <RightKnee>The Right Knee</RightKnee>
         </RightLeg>
         <Extension id="extid">
            <ANewLimb>Some new Limb</ANewLimb>
         </Extension>
         <RightFoot>The Right Foot</RightFoot>
         <RightKnee>The Right Knee</RightKnee>
         <Heart>The Heart</Heart>
         <Extension id="extid">
            <ANewLimb>Some new Limb</ANewLimb>
         </Extension>
         <AnotherNewLimb>Another New Limb</AnotherNewLimb>
      </Torso>
   </Body>
</SeeThreePO>

Which makes sense to me, but its not what I want.

Any ideas?
-Brent

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread