[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Is it possible to create xsl:sort from input parameters using XSLT 2.0 (Saxon)?


Subject: RE: [xsl] Is it possible to create xsl:sort from input parameters using XSLT 2.0 (Saxon)?
From: Nick Glenister <NGlenister@xxxxxxxxxxxxxxxx>
Date: Thu, 2 Nov 2006 12:18:59 -0000

Hi,

Sorry to bring this problem up again but I'm still having problems with
getting this sort to work.

To recap I have an XSLT that transforms XML into ASP.NET which shows a list
of financial products and some basic details. In order to sort these
products I am passing in a second XML document node in the following format:

<SortFields>
	<SortField>
		<Sort>lendername</Sort>
		<Order>ascending</Order>
		<DataType>text</DataType>
		<CaseOrder>lower-first</CaseOrder>
	</SortField>
	<SortField>
		<Sort>lenderid</Sort>
		<Order>ascending</Order>
		<DataType>text</DataType>
		<CaseOrder>lower-first</CaseOrder>
	</SortField>
	<SortField>
		<Sort>productid</Sort>
		<Order>ascending</Order>
		<DataType>text</DataType>
		<CaseOrder>lower-first</CaseOrder>
	</SortField>
</SortFields>


This xml is passed into this parameter:

<xsl:param name="sortField" as="document-node()"/>

This XML document defines three levels of sorting and is applied to the
primary XML using the following XSLT (separated over several lines for
clarity in the e-mail. There is one of these sort elements for each of the
three sorts):

<xsl:sort select="$sortField/SortFields/SortField[1]/Sort"
order="{$sortField/SortFields/SortField[1]/Order}" 
data-type="{$sortField/SortFields/SortField[1]/DataType}" 
case-order="{$sortField/SortFields/SortField[1]/CaseOrder}" />


The problem is that it doesn't work. There are no errors but the sorting
does not occur. Doing a <xsl:value-of
select="$sortField/SortFields/SortField[1]/Sort"/> brings through the string
"lendername" I just can't see why the sorting is not working. Hard coding
the value "lendername" sorts the output perfectly so I'm sure that XSLT is
operating ok in all other repects.


Current Thread
Keywords