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
Postnext
chelsea drennanSubject: Calculating a Date based on 4 Scenarios
Author: chelsea drennan
Date: 07 Jan 2009 07:57 PM
Hi XSLTers,

I have a problem that I need to solve in v1.0 which as 4 scenarios as described below.

- The variabe is the Vest Date. The only valid values for this are the 1st and 15th of the month accordingly.

There are a couple of unique cases which I need to transform
o Vest Date that occurs on the 1st, the date remains the 1st aka 04/01/2008
o Vest Date that occurs between the 2nd 15th, the date is merely rounded to the 15th. 04/15/2008
o Vest Date that occurs between the 16th 31st, the date is merely rounded to the 1st of the following month. 05/01/2008 (A month gets added and the day to 1)
o And in the most rare of cases, if the Vest Date is between the 16th and 31st of December, the day is the 1st, month is the 1st, and year is added by 1. 12/26/2008 --> 01/01/2009


I am trying to determine the best way, or a way at all, to accomplish the following scenarios using if/when/choose statements. The main problem I see is that I have to extract all the data into variables - ie Month, Day, and Year, calculate based on those, and then reinsert those values.

Help is much appreciated.

Thanks,
C

Postnext
Alberto MassariSubject: Calculating a Date based on 4 Scenarios
Author: Alberto Massari
Date: 08 Jan 2009 09:57 AM
Hi Chelsea,
in XSLT 1.0 you can only do it by using substring-after/substring-before to split the dates into their components, and then re-assemble the new values using concat().

Alberto

Posttop
chelsea drennanSubject: Calculating a Date based on 4 Scenarios
Author: chelsea drennan
Date: 08 Jan 2009 11:03 AM
Hi Alberto,

Thanks for pointing me in the right direction. I was hoping there was something better than that, but with the restraint of v1, you are right.

I will give it a shot now.

Cute daughter!

Chelsea

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