[xsl] <xsl:sort> using param (I've read the old thread, this isn't the same thing, I promise :P)

Subject: [xsl] <xsl:sort> using param (I've read the old thread, this isn't the same thing, I promise :P)
From: "Jonathan Furrer" <xsl-list@xxxxxxxx>
Date: Fri, 7 Jun 2002 16:09:43 -0700
I'm using a <xsl:param> element globally to dynamically sort based on
elements. This is working well, the problem is along with the sort by
element I alos have other params to identify the data-type and order
attributes of <xsl:sort> the params I'm using for those don't seem to be
getting passed as everything comes ascending, the sort by element is passing
just fine, but the order and data-type aren't...any advice.

I do hope this isn't some petty issue, I've been searchign for a day and
haven't found the answer in another group yet, and this list had a thread on
using the *[name()=$param] method to convert a param to an XPath Expression,
so I hoped someone here might have an answer for me. My code is below, now,
without any further babbling, here are the snippets :)

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

<xsl:param name="sortby" select="'title'"/>
<xsl:param name="sortorder" select="'descending'"/>
<xsl:param name="sortdatatype" select="'text'"/>

<xsl:output method="html"/>



<xsl:template match="/">
  <xsl:apply-templates select="media"/>
</xsl:template>

<xsl:template match="media">
  <xsl:apply-templates select="mediaobj">
    <xsl:sort select="*[name()=$sortby]" data-type="$sortdatatype"
order="$sortorder"/>
  </xsl:apply-templates>
</xsl:template>


now that you've read my code, the further explanation is this. The code is
working fine as far as running, and even sorting (with default attributes
like ascending for order and text for data-type) I've tried the param values
with double-single quotes ("'text'") and just double quotes ("text"). Now,
when ran the code doesn't use the default param value of descending, but
rather the default function value of ascending, however I can change the
element it sorts by. Any help greatly appreciated, I've babbled on enough.



_________________________________________
Jonathan Furrer
jonny@xxxxxxxx


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


Current Thread