[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Calculate Monthly Recuring dates

Subject: Re: Calculate Monthly Recuring dates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Jan 2007 15:58:52 GMT
Re:  Calculate Monthly Recuring dates
> (BTW - my XSLT Processor is Saxon 8 and I am already making use of EXSLT
> for other date related operations).

why use EXSLT which are date extensions for XSLT1, when saxon8 has the
XPath2 date functions already?

This for example returns the first saturday of the current month.

$ saxon8 -it main saturday.xsl 
<?xml version="1.0" encoding="UTF-8"?>
today:  2007-01-30Z
1st of month   2007-01-01Z
1st day month   Monday
1st saturday of month : 2007-01-06Z


<xsl:stylesheet version="2.0" 
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  

<xsl:template name="main">
today:  <xsl:value-of  select="current-date()"/>
<xsl:variable name="today" select="current-date()"/>
<xsl:variable name="fom" 
  select="current-date()- xs:dayTimeDuration(concat('P',day-from-date(current-date())-1,'DT0S'))"/>
1st of month   <xsl:value-of  select="$fom"/>
1st day month   <xsl:value-of  select="format-date($fom,'[F]')"/>
1st saturday of month : <xsl:value-of select="(for $d in  0 to 6
  return
   $fom + xs:dayTimeDuration(concat('P',$d,'DT0S')))[format-date(.,'[F]')='Saturday']
  "/>
</xsl:template>
</xsl:stylesheet>


David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.