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)
-> + Merging Table Cells in XSLT re... (3)
-> + xsl fo block-container and foo... (2)
-> + Is is possible to create a .CO... (2)
-> + printing a parent node value i... (2)
-> + Mime header info setup? (3)
-> - Calculating a Date based on 4 ... (3)
-> ->Calculating a Date based ...
-> ->Calculating a Date based ...
-> + XSLT formatting number issue (10)
-> + map repeating elements separat... (3)
-> + Combining XML elements based o... (3)
-> + Convert XML to UTF-8 (8)
-> + XSLT and MS Access 2007 Optio... (5)
-> - WORDML list to XML list (1)
-> + [Newbie] Using lookups in XSLT... (3)
-> + Comparing 2 passed Date Values (2)
-> + ERROR XQueryMediator Error du... (2)
-> + XML / XSLT... Unordered lists ... (2)
-> + Specify image path in XSL (2)
-> + Variable within a variable (3)
-> + How to call jfreechart method ... (8)
-> + leading and trailing white spa... (2)
-- Previous [421-440] [441-460] [461-480] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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
(Deleted User) Subject: Calculating a Date based on 4 Scenarios
Author: (Deleted User)
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

   
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.