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 September 11th, 2008, 09:28 AM
Authorized User
 
Join Date: Feb 2008
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem of grouping in XSLT

I need to group the following data which i get in the below format from the xml.I am using XSLT 1.0

Existing data

PO# Program Pattern Style Color Width Size
100 FLORENTINE MIDGE 74199 BLACK M 5
100 FLORENTINE MIDGE 74199 BLACK M 5
100 FLORENTINE MIDGE1 74100 BLACK M 5
100 FLORENTINE1 MIDGE1 74100 BLACK M 5
101 FLORENTINE1 MIDGE1 74101 BLACK M 5

Expected Result:
PO# Program Pattern Style Color Width Size
100 FLORENTINE MIDGE 74199 BLACK M 5
                             74199 BLACK M 5
                    MIDGE1 74100 BLACK M 5
                             74100 BLACK M 5
101 FLORENTINE1 MIDGE1 74101 BLACK M 5

I tried grouping in many ways but still could not get a solution to this.<b>Specially making the column fields as empty.</b>

 
Old September 11th, 2008, 09:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You say you've tried many ways, but you don't say what you tried.

For XSLT 2.0, use xsl:for-each-group. That should make this problem very easy.

For XSLT 1.0, use Muenchian grouping. You can find that covered in most textbooks, or google for Jeni Tennison's tutorial on the subject. It's seems very tricky at first, but you get the hang of it.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old September 11th, 2008, 09:38 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Can you post the input in XML format?

--
  Martin Honnen
  Microsoft MVP - XML





Similar Threads
Thread Thread Starter Forum Replies Last Post
Grouping with XSLT 1.0 rodmcleay XSLT 1 January 14th, 2008 11:42 PM
XSLT Grouping vernc XSLT 2 October 2nd, 2007 03:59 AM
XSLT 1.0 Grouping kwilliams XSLT 0 January 11th, 2006 06:30 PM
XSLT Grouping Help Missy XSLT 0 December 14th, 2005 10:28 PM
xslt 1.0 distinct grouping cassebn XSLT 3 July 30th, 2003 07:31 AM





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