[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

Subject: 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
xml node structure
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.