PDA

View Full Version : <xsl: sort> question


brendon99
12-01-2003, 01:32 AM
Hi,

I have an XML document to which I've applied an XSL template. I've got three fields, which I can easily define the sort with, but now I want to include a fourth column and sort on it.

ie.
Column_A Column_B Column_C Column_D

This fourth column represents data from a different XML document. I've got this happening, and now I want to sort on this fourth column - is this possible? I have a bad feeling its not, since its a calculated field, but maybe........?

thanks

me'
12-04-2003, 10:16 PM
<xsl:sort> can do alphabetical ordering as well, if that's what you mean.

brendon99
12-10-2003, 03:09 AM
Cheers 'me,

I was actually referring to the field name itself. The fourth column value was in a different XML document - I was looking it up based on the first column value.

ie. @field1, @field2, @field3, @another_file_value

in your xsl sort, you'd usually specify:
<xsl:sort select="@field1">


But @another_file_value isn't in the original file - its calculated on the fly when displaying on the screen. I got around it - I simply used Javascript to update the original XML doc with the calculated values - then I could easily sort on it. Bit of a workaround, but it works well enough.