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

RE: grouping by child element

Subject: RE: grouping by child element
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 16 Oct 2000 17:30:01 +0100
xsl sorting composite
> I have a simple list of data coming from a stored proc.  I 
> have a sort set up based on user selection.
> the xml looks like this (using soap request/response method)
> <GetMerchantListResponse>
> <Merchant merchID="some_number">
> 	<merchName>Some_name</merchName>
> 	<merchActive>boolean value</merchActive>
> 	<merchIsoID>ISO ID number</merchIsoID>
> </Merchant>
> </GetMerchantListResponse>

> I have them sorted (initially) by merchIsoID.  What I need to 
> do is group them into tables based on this element.

Have you read the FAQ (follow the link at the bottom of this mail) on
sorting and grouping?
> 
> Below is the xsl i am working with:
> <xsl:template match="/">
> 		<xsl:apply-templates select="//SOAP-ENV:Fault"/>
> 		<xsl:apply-templates select="//GetMerchantListResponse">
> 		<xsl:sort select="//Merchant"/>
> 		</xsl:apply-templates>
> 	</xsl:template>
> 
The "//" at the beginning of the first two expressions is inefficient but
not incorrect. In the <xsl:sort> it is disastrous: it means that instead of
selecting the Merchant part of each GetMerchantListResponse, you are using
the first Merchant in the data as the sort key for each record. 

In any case, Merchant seems an odd choice of sort key as it is a composite
value. Your narrative suggests that you want <xsl:sort
select="Merchant/merchIsoId"/>

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.