Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2013, 08:23 AM
Authorized User
 
Join Date: May 2009
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default time subtraction in xslt 1.0

Hi All,
I want to subtract '2 hours' from a given time in xslt 1.

E.g.

Code:
<xsl:variable name="time">
         <xsl:choose>
       <xsl:when test="ns0:DepartureTime !=''">
        <xsl:value-of select="ns0:DepartureTime"/>
       </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="'00:00:00'"/>
           </xsl:otherwise>
         </xsl:choose>
        </xsl:variable>
I want from this $time variable now subtract 2 hours and set it's value to an attribute.

Code:
<xsl:value-of select="$time"></xsl:value-of>
Could some please help?
 
Old May 31st, 2013, 10:08 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

XSLT 1.0 doesn't do dates or times, so basically you have to do string manipulation, or numeric manipulation.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtraction in an Access Query pankaj_daga Access 2 April 13th, 2007 06:49 AM
subtraction operator overload arnie6 C++ Programming 0 April 19th, 2005 07:57 AM
Modifying time with XSLT bigdog-yahoo XSLT 3 March 30th, 2005 11:56 AM
Dates Subtraction akhamis SQL Language 1 December 2nd, 2004 04:38 PM
subtraction collie SQL Server 2000 3 November 26th, 2004 01:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.