[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Question about grouping

Subject: Question about grouping
From: David Frey <dpfrey@xxxxxxx>
Date: Thu, 23 Sep 2010 18:50:50 -0700
 Question about grouping
I have an XSLT problem that I haven't been able to figure out.  The example 
below is essentially the simplest version of the problem I have encountered.

Say you have a document like this:

<doc>
  <book title="aaa" author="jones"/>
  <book title="bbb" author="smith"/>
  <book title="ccc" author="douglas"/>
  <book title="ddd" author="jones"/>
  <book title="eee" author="jones"/>
  <book title="fff" author="douglas"/>
  <book title="ggg" author="smith"/>
</doc>


How can you produce a document like this?:

<report>
  <author name="jones">
	<title>aaa</title>
	<title>ddd</title>
	<title>eee</title>
  </author>
  <author name="smith">
	<title>bbb</title>
	<title>ggg</title>
  </author>
  <author name="douglas">
	<title>bbb</title>
	<title>fff</title>
  </author>
</report>

Restrictions:
- Only XSLT 1.0
- You can't hard-code the names of the books or the authors in the XSLT.


Thanks,
Dave

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.