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

Sorting problem

Subject: Sorting problem
From: "Alex Scott" <fastidiously@xxxxxxxxxxx>
Date: Fri, 03 Sep 2004 15:46:31 +0100
fruits sorting table
Hi There,

My brain is getting a bit mangled with some sorting. Should I be using a
system of grouping? I want to avoid going through multiple pipelines.

I am trying to group a set based on a list of fruits (Filtered down from
using a lookup table)

I then want to take each fruits and sort it based on an order of
ascending quality. (The Order is defined in another lookup).

Then if there is more than one 'quality' of the same type for an
individual fruit ie. bad apple below, I just want to display a count.
This is how I would like it to look:

apple: bad(2),good
orange: good
satsuma: bad,good,excellent

Below is a summary of the code that is not working - basically losing
fruit depending on the XML ie.:

apple: bad(2),good
orange: good
satsuma: 

<xsl:for-each select="Go through fruit nodes in the XML">                
<xsl:sort select="Sort them based on the order of quality defined in the
lookup table"/>
<xsl:variable name="count" select="Count from the XML how many
replications there are of the the same quality for each fruit"/>
<xsl:variable name="lastQuality" select="Get the quality level for each
fruit"/>
<xsl:if
test="not(preceding-sibling::fruit[@quality=$lastQuality]/@quality)">
	<xsl:value-of select="@quality"/>
		<xsl:if test="$count>1">
		(<xsl:value-of select="$count"/>)
		</xsl:if><br/>
		</xsl:if>
	</xsl:for-each>

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.