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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
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...

Posttop
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.

   
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!  
go

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.