XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
LZ AlexSubject: Sort data-type problem
Author: LZ Alex
Date: 05 Aug 2005 05:03 AM
Hi guys, I hope you can help me because I was looking deeply for
a solution but no one for the moment. (Sorry for my english).

Let's see: I have a XSL StyleSheet which receives 10 parameters
coming from 10 <SELECT> on a web page where the user select
one by one, the fields he want the data (table) to be sorted.

At the begining I added 10 <sort> tags to the <for-each> loop
which process the data. That's ok.

After that, I find the "data types" problem: text, number and date fields.
I solved the problem with TEXT and NUMBER fields because I have
in one XML the metadata about each field including its data type and
I put an adequate XPATH expression in the "data-type" of each "sort" tag.

My problem is that I have to detect the "date" fields at runtime
to put an apropiate <sort> tag on the form:

<xsl:sort select="substring('date-field',7,4)" order="ascending" data-type="number"> <-- year -->
<xsl:sort select="substring('date-field',4,2)" order="ascending" data-type="number"> <-- month -->
<xsl:sort select="substring('date-field',1,2)" order="ascending" data-type="number"> <-- day -->

Let me know if you need more comments, code...

Please, help!! I'm becoming desperate...

Tony LavinioSubject: Sort data-type problem
Author: Tony Lavinio
Date: 15 Aug 2005 11:28 AM
I don't really understand the question. But if the question is how
do you sort a date with one xsl:sort tag, then just use concat() to add
together the parts of the date in yyyymmdd format, then you can sort as
a string or a number.

Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.