|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sorting problem
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








