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 June 21st, 2010, 05:07 PM
Registered User
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transformation for repeating nodes

How can I trasnform using XSL 1.0

<Region>
<RecType1><Amt> 100 </Amt></RecType1>
<RecType2><Name>XXX</Name></RecType2>
<RecType1><Amt> 200 </Amt></RecType1>
<RecType2><Name>YYY</Name></RecType2>
<RecType1><Amt> 300 </Amt></RecType1>
<RecType2><Name>ZZZ</Name></RecType2>
</Region>

TO

<Region>
<Payment><Amt>100</Amt><Name>XXX</Name></Payment>
<Payment><Amt>200</Amt><Name>YYY</Name></Payment>
<Payment><Amt>300</Amt><Name>ZZZ</Name></Payment>
</Region>

I appreciate your help.

Thank you,
Praveen
 
Old June 21st, 2010, 05:18 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Code:
<xsl:for-each select="RecType1">
  <Payment>
     <xsl:copy-of select="Amt"/>
     <xsl:copy-of select="following-sibling::RecType2[1]/Name"/>
  </Payment>
</xsl:for-each>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL transformation in browser outputs data (text nodes) only JohnBampton XSLT 2 March 10th, 2009 09:35 AM
repeating data ph0neman Classic ASP Basics 5 January 18th, 2008 12:34 PM
Repeating Region DynaCube Classic ASP Basics 0 January 12th, 2007 11:26 PM
repeating tables gianca Infopath 1 November 29th, 2006 01:27 AM
Repeating Records Nicky_uk Classic ASP Databases 7 February 2nd, 2005 05:41 PM





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