Re: [xsl] Adding attributes

Subject: Re: [xsl] Adding attributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 7 Feb 2002 14:43:27 GMT
  this'll work:

  <xsl:template match="myelement">
  	<xsl:copy>
  		<xsl:copy-of select="attribute::*"/>
		<xsl:attribute name="color">blind</xsl:attribute>


That's OK although you can also do


<xsl:template match="myelement">
  <myelement color="blind">
	<xsl:copy-of select="@*"/>


However beware
		<xsl:copy-of select="descendant::*"/>


that would expand out all the nodes below the current node, normally
you'd just want <xsl:copy-of select="node()"/>

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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


Current Thread