Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2007, 05:47 AM
Authorized User
 
Join Date: Feb 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to make child dynamically

in my source xml the node stuctute is like that...
<root>
 <group name="G_1"/>
 <group name="G_2"/>
 <group name="G_3"/>
</root>

i want to make it in mys result xml like that..
<root>
 <group name="G_1">
     <group name="G_2">
        <group name="G_3"/>
      </group name="G_1">
   </group name="G_1">
</root>

how to do that by xsl...can anybody pls help me....thnx
 
Old February 23rd, 2007, 06:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can't have attributes in an end tag.

Try

<xsl:template match="root">
<xsl:copy>
  <xsl:apply-templates select="*[1]"/>
</xsl:copy>
</xsl:template>

<xsl:template match="group">
<xsl:copy>
  <xsl:copy-of select="@name"/>
  <xsl:apply-templates select="following-sibling::*[1]"/>
</xsl:copy>
</xsl:template>


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Make A New Folder Dynamically sumith ASP.NET 1.0 and 1.1 Basics 2 June 24th, 2007 12:21 AM
Dynamically Altering a Child Control's Method forkbeard ASP.NET 2.0 Professional 2 May 15th, 2007 07:13 PM
How can I make Child applet for chat?? rabindratm Java GUI 0 May 10th, 2005 09:48 AM
Make child close automatically after 3 seconds sherbir Javascript 2 August 25th, 2004 11:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.