|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: copying a node structure to another part of an xml
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[@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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








