[xsl] having trouble with xsl:choose and xsl:sort

Subject: [xsl] having trouble with xsl:choose and xsl:sort
From: "Cox, Todd (NIH/NCI)" <tcox@xxxxxxxxxxxx>
Date: Sun, 5 Jan 2003 00:32:20 -0500
Hello All,

I am tring to provide sorting a sorting capability using parameters as my
selecting process. I am using Cocoon and when I try to use a <xsl:choose>
and select a <xsl:sort> I get a Can't have a <xsl:sort> in a <xsl:choose>.
The the stylesheet is as follows:

<xsl:param name="sort"/>
<xsl:for-each select="all_volumes_detail/volume_Detail">
<xsl:choose>
<xsl:when test="$sort='server'">
	<xsl:sort select="server_name"/>
</xsl:when>
<xsl:otherwise>
	<xsl:sort select="format-number((number(used_space) div
number(total_space)) * 	100,'0')" order="descending" data-type="number"/>
</xsl:otherwise>
</xsl:choose>
<tr>      		
        			
        			<td><xsl:value-of
select="server_name"/></td>
        			<td><xsl:value-of select="nds_name"/></td>
					<td><xsl:value-of
select="short_name"/></td>
					<td><xsl:value-of
select="dir_entries"/></td>
					<td><xsl:value-of
select="avail_dir_entries"/></td>
					<td><xsl:value-of
select="total_space"/> GB</td>
					<td><xsl:value-of
select="used_space"/> GB</td>
					<td><xsl:value-of
select="avail_space"/> GB</td>
					<td><xsl:value-of
select="purge_space"/> MB</td>
					<xsl:choose>
          				<xsl:when
test="format-number((number(used_space) div number(total_space)) *
100,'0')&gt;'90'">
            				<td bgcolor="#ff0000"><xsl:value-of
select="format-number((number(used_space) div number(total_space)) *
100,'0')"/>%</td>
            			</xsl:when>
          			<xsl:otherwise>
            			<td><xsl:value-of
select="format-number((number(used_space) div number(total_space)) *
100,'0')"/>%</td>
          			</xsl:otherwise>
        			</xsl:choose>

The sort works if I don't use the <xsl:choose>. Does anyone have any ideas?

Thanks,

Todd Cox
National Cancer Institute

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


Current Thread