[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Using copy to change a node, whilst retaining the attributes


Subject: RE: [xsl] Using copy to change a node, whilst retaining the attributes
From: "John Reid" <John.Reid@xxxxxxxxxxxxxxx>
Date: Tue, 5 Aug 2003 08:02:33 +1000

I have looked at the FAQ, a  number of times especially at the copy
examples but..

When @pword="843208" and @ID>=20030808 and @ID<=20030810 make the yes
text = "C"
Salud

John 

<player pword="843208">
  <dates>
	<yes ID="20030722" WE="Tu">A</yes>
>     <yes ID="20030729" WE="Tu">A</yes>
>     <yes ID="20030805" WE="Tu">A</yes>
>     <yes ID="20030809" WE="Sa">D</yes>

<player pword="843208">
  <dates>
     <yes ID="20030722" WE="Tu">A</yes>
>     <yes ID="20030729" WE="Tu">A</yes>
>     <yes ID="20030805" WE="Tu">A</yes>
>     <yes ID="20030809" WE="Sa">C</yes>

<xsl:param name="pmkey" select="0" />
<xsl:param name="type" select="0" />
<xsl:param name="from" select="0" />
<xsl:param name="to" select="0" />

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

   <xsl:template match="yes">
     <xsl:copy>
<-- copy all attribute nodes -->
       <xsl:copy-of select="@*"/>
<-- recurse thru all other nodes except those that are in the condition
-->
	<xsl:apply-template select="not(ancestor::player/@pword=$pmkey
and @ID &gt;= $from and @ID &lt;= $to)"
<-- copy the new type in -->
	$type
   </xsl:copy>
   </xsl:template>

</xsl:stylesheet>


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



Current Thread