RE: Copy attribute from a node to another

Subject: RE: Copy attribute from a node to another
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 14 Dec 1999 15:53:48 -0000
> A node in my XML looks like this:
> 
>   <node align="right">some text</node>
>     
> And in my xsl i want to transform it to
> 
>   <node align="right">some text
>     <subnode>
>       <format width="45" align="right"/>
>     </subnode>
>   </node>
> 
> All data in 'subnode' and 'format' are static except for 'align'
> that comes from 'node'. 

<xsl:template match="node">
<xsl:copy>
	<xsl:for-each select="@align">
		<xsl:copy/>
	</xsl:for-each>
      <subnode>
       	<format width="45" align="right"/>
      </subnode>
</xsl:copy>
</xsl:template>

Mike Kay


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


Current Thread