Sort Problem

Subject: Sort Problem
From: Heather Lindsay <heather.lindsay@xxxxxxxxxxxxx>
Date: Mon, 7 Aug 2000 10:49:59 -0400
hi,
	Below is a snippet of my code.  I am using a parameter called
"SORT_BY" to sort only when "SORT_BY" has a value.  The value of "SORT_BY"
is (I've tested to be sure) the value of the child element to sort by or the
value is undefined.  If the value is undefined then sorting is not done.  My
problem is that when I do have a "value" to sort by, the code still behaves
as if it did not sort.  I must be missing something here.  Any help would be
greatly appreciated.  Also, there is a good bit of javascript in my code but
I left it out because it is irrelevant to the problem.


<xsl:param name="SORT_BY" select="undefined"/>   

<xsl:template match="/">

	<HTML>
		<head>	
			<SCRIPT language="JavaScript">
				function init() {              <!-- this
function builds a table -->
				.
				bunch of javascript
				.
				<xsl:choose>
					<xsl:when test="$SORT_BY !=
undefined">
						<xsl:for-each
select="ToDoList/ActionItem">
							<xsl:sort
data-type="text" select="$SORT_BY" order="ascending"/>
								<xsl:if
test="position()&gt;=$FIRST_TABLE_ENTRY and
position()&lt;=$LAST_TABLE_ENTRY">
								       more
javascript + XSL
									<!--
builds a row in the table -->
								</xsl:if>
						</xsl:for-each>
					</xsl:when>
					<xsl:otherwise>
						<xsl:apply-templates
select="ToDoList/ActionItem[position()&gt;=$FIRST_TABLE_ENTRY and
position()&lt;=$LAST_TABLE_ENTRY]"/>
					</xsl:otherwise>
				</xsl:choose>
				....
				more javascript
				...	
			</SCRIPT>
		</head>
......
</xsl:template>

 


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


Current Thread