Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Nick Glenister <NGlenister@---------------->
To:
Date: 11/2/2006 12:20:00 PM
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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent