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 October 4th, 2004, 04:15 PM
Registered User
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rearranging XML - Urgent.

I am new to XSL. I have the following Input XML.

<books>
   <book>
      <author>John Smith</author>
      <name>Introduction to XML</name>
      <address>123 Elm St.</address>
      <phone>(123) 456-7890</phone>
   </book>
   <book>
      <author>John Smith</author>
      <name>Introduction to XSL</name>
      <address>456 Oak Ave.</address>
      <phone>(156) 789-0123</phone>
   </book>
   <book>
      <author>Mike</author>
      <name>Introduction to XSLT</name>
      <address>456 Oak Ave.</address>
      <phone>(156) 789-0123</phone>
   </book>
</books>

Books need to be grouped by author. In the above example John Smith is the author for two books, so the output xml should look like the following.

<authors>
    <author>
            <name>John Smith</name>
            <book>
                <name>Introduction to XML</name>
                <name>Introduction to XSL</name>
            </book>
        </author>
        <author>
            <name>Mike</name>
            <book>
                <name>Introduction to XSLT</name>
            </book>
        </author>
</authors>.

I really appreciate if you can help me with XSL.
 
Old October 4th, 2004, 04:25 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

For an introduction to grouping in XSLT, see

http://www.jenitennison.com/xslt/grouping

It gets much easier in XSLT 2.0.



Michael Kay
http://www.saxonica.com/
 
Old October 6th, 2004, 03:08 PM
Registered User
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a ton Michael, per your suggestion I used Muenchian Method and it worked.

Thanks once again,
--R





Similar Threads
Thread Thread Starter Forum Replies Last Post
rearranging query result rows on a report ronin2307 Crystal Reports 0 November 18th, 2008 12:29 PM
Opening XML. Its too urgent dhara_adh XML 2 January 29th, 2007 05:27 AM
Xml to XML using XSLT (urgent) [email protected] XSLT 1 December 30th, 2005 01:48 PM
Urgent help regarding XSLT parsing.... to xml.. netbramha XSLT 1 September 19th, 2005 09:03 AM
C# with XML. Urgent!Please Help! jayce C# 13 October 10th, 2003 01:43 AM





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