The XSLT I tried is at the end, but it I am looking for a more elegant
approach
I want to add a player in copying the dates from first fragment in
Start with this:
<team>
<player name="MASTER">
<yes ID="20030603">
</yes>
<yes ID="20030607">
</yes>
<yes ID="20030608">
</player>
</team>
End with this:
<team>
<player name="MASTER">
<yes ID="20030603">
</yes>
<yes ID="20030607">
</yes>
<yes ID="20030608">
</player>
<player name="JOHN">
<yes ID="20030603">
</yes>
<yes ID="20030607">
</yes>
<yes ID="20030608">
</player>
</team>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="event/team">
<xsl:copy>
<xsl:copy-of select="@*|node()"/>
<xsl:element name="player">
<xsl:attribute name="name"><xsl:value-of select="$name"
/></xsl:attribute>
<xsl:for-each select="player[(_at_)name='MASTER']/yes" >
<xsl:element name="yes">
<xsl:attribute name="ID"><xsl:value-of select="@ID"
/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:copy>
</xsl:template>
Any ideas?
salud
John Reid
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list