|
Subject: [xsl] RE: copying a node structure to another part of an xml document From: "John Reid" <John.Reid@xxxxxxxxxxxxxxx> Date: Thu, 29 May 2003 06:21:45 +1000 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Trouble keeping html tags, J.Pietschmann | Thread | [xsl] Referencing a external script, John Reid |
| RE: [xsl] Access all values, Passin, Tom | Date | [xsl] Flat -> Hierarchy, Dongling Ding |
| Month |