Sorting revisited (<xsl:sort>)

Subject: Sorting revisited (<xsl:sort>)
From: r.mcarthur@xxxxxxxxxxxx
Date: Tue, 30 Nov 1999 10:51:21 -0500
I've searched through the archive and haven't found how to do the following
dynamic sorting:

I have a document like this:

     <item1>  </item1>
     <item2>  </item2>

The tags <item1>, <item2>, can have any legal XML tag name, and there can be
any number of them (I personally would like to re-write to XML document so I
can make a DTD, but have to work with what I have).

The XSL output I made so far is a table with the tag names as headers, and
allows 'text ascending' sorting on any column.  I need to extend this to
allow ascending/descending switching and text/number switching.  I'm
currently passing in parameters into the template, but can't seem to get
them to work for the data-type and order attributes of <xsl:sort>

The params are passed into the template.

<xsl:param name="sortby"></xsl:param>
<xsl:param name="datatype">number</xsl:param>
<xsl:param name="orderby">descending</xsl:param>

<!-- the important part is as follows -->
<xsl:template match="/">
	<!-- snip -->
	<xsl:apply-templates />
                <xsl:sort select="*[local-name()=string($sortby)]"
data-type="{$datatype}" order="{$orderby}" />
	<!-- snip -->

The XSL spec says that data-type and order can use attribute value
templates, but the above code doesn't work (defaults are used instead).

I'm using XT version 19991105, and have already tried the following:

1. remove { }
2. put quotes around param values
3. used select="descending" for param
4. used order="string($orderby)"
5. used order="string({$orderby})"
6. used order="{string($orderby)}"

... and probably some I've forgotten.

What am I not understanding about attribute value templates?

Thanks in advance,

Rob McArthur

 XSL-List info and archive:

Current Thread