Re: [xsl] Sorting problem...

Subject: Re: [xsl] Sorting problem...
From: cutlass <cutlass@xxxxxxxxxxx>
Date: Wed, 14 Feb 2001 11:01:49 +0000
David M. Goudreau wrote:

I'm trying to sort some concatenated strings in a dropdown box in my XSL.
(I'm also sure there's a more compact way to write my XSL, frankly).  My XML

<root sub_id="84">
	<folder name="c" cdate="2/13/01" id="f_49">
		<folder name="m" cdate="2/13/01" id="f_42" />
	<folder name="y" cdate="2/13/01" id="f_45" />
	<folder name="d" cdate="2/13/01" id="f_43" />
	<folder name="r" cdate="2/13/01" id="f_44" />
	<folder name="d" cdate="2/13/01" id="f_49">
		<folder name="t" cdate="2/13/01" id="f_42">
			<folder name="z" cdate="2/13/01" id="f_42">

I want my output to look alphabetical like the following:


My XSL looks like this:

try using something like <xsl:sort select="@name"/> to handle your alpha sort first, the rest is recursion


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="";>
<xsl:output method="html"/>
<xsl:template match="root">

<xsl:apply-templates select="folder">
<xsl:sort lang="en" select="@name" data-type="text"/>


<xsl:template match="folder">
<xsl:value-of select="@name"/>

i leave the select / option tag stuff to u.

w3 org on sorting

xsl faq on sorting in general

,jim fuller

XSL-List info and archive:

Current Thread