date - xslt - subtracting days -


is possible xslt take date field , subtract n number of days it? if so, can please provide me example?

here demonstration how in xslt 2.0:

<xsl:stylesheet version="2.0"  xmlns:xsl="http://www.w3.org/1999/xsl/transform"  xmlns:xs="http://www.w3.org/2001/xmlschema">  <xsl:output method="text"/>   <xsl:template match="/">   <xsl:variable name="vtoday" select="current-date()"/>    today is: <xsl:sequence select="$vtoday"/>   30 days ago was: <xsl:sequence select=     "$vtoday -30*xs:daytimeduration('p1d')"/>   365 days ago was: <xsl:sequence select=     "$vtoday -365*xs:daytimeduration('p1d')"/>  </xsl:template> </xsl:stylesheet> 

when transformation applied on xml document (not used), wanted, correct result produced:

  today is: 2010-10-07-07:00   30 days ago was: 2010-09-07-07:00   365 days ago was: 2009-10-07-07:00 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -