[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How can I sort values that have been calculated dynami

Subject: How can I sort values that have been calculated dynamically?
From: Bryan Tulloch <b.tulloch@xxxxxxxxxxxxx>
Date: Fri, 13 Jul 2001 11:18:11 +0100
sort values
Hello,

This is connected to my earlier thread (Sorting a Nodeset contained within a
Variable), but as I haven't got that working I will try a more general
approach. Here goes:

My XML is a series of User elements structured as follows:

<User>
	<User_Name></User_Name>
	<Case_Code></Case_Code>
	<Case_Title></Case_Title>
	<Cost_Item>
		<User_ID></User_ID>
		<Job_Description></Job_Description>
		<Charge_Rate></Charge_Rate>
		<Item_Date></Item_Date>
		<Item_Description></Item_Description>
		<Time_Minutes></Time_Minutes>
		<Cost></Cost>
	</Cost_Item>	
  </User>

There may be a number of such entries with the same User_Name and a number
of those may have the same Case_Code and Case_Title. 

The desired output:
I am outputting a table with a series of columns, each of which has a
heading which, when clicked, will sort the table data according to the
heading clicked. 

Where I am at present:
Some of the columns contain data contained in the source XML (eg there are a
User_Name column and a Case_Code column); when these are clicked they are
sorting the data as required.

The problem:
Some of the columns contain data that is not directly in the source XML but
is computed from it (eg there is a column containing the total number of
unique Case_Code elements for each unique User_Name).  I have a template
matching each unique User_Name, and within this the data is being output
into the table using this code:

     <TH>
	<xsl:variable name="ThisUser" select="." />
     <xsl:value-of
select="count(//User[./User_Name=$ThisUser][not(Case_Code=preceding::Case_Co
de)])" />
     </TH>

 however, I have not been able to code the column heading so that it sorts
by this column when clicked.

Any suggestions as to how to go about this?

Bryan

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.