Subject: [xsl] How to implement date difference in XSLT 1.0 From: abhilash k <abhilash_bmc@xxxxxxxxx> Date: Tue, 29 Sep 2009 22:00:17 +0530 (IST) |
Hi Guys...need your help in below explained XML to CSV transformation. Input: ------- <Result> <Timesheet> <ID>888001</ID> <Name>Abhi</Name> <Week_Ending_Date>9/1/09</Week_Ending_Date> <Dept>Test Department</Dept> <Hours_Basic_Saturday>5:00</Hours_Basic_Saturday> <Hours_Basic_Sunday>0:00</Hours_Basic_Sunday> <Hours_Basic_Monday>9:00</Hours_Basic_Monday> </Timesheet> </Result> Desired Output: ----------------- The CSV file should have multiple records depending on days worked and --> Word date as a date value derived from 'Week_End_Date' which is always a friday date. i.e if Week_End_Date is 02/10/2009, Work date for Monday should be derived by something like date(Week_End_Date) - 4. Any idea how can i implement such date functions in XSLT 1.0 to get the below given output. ID, Name, Week Ending, Dept, Work Date, Reg Hours 888001, Abhi, 2/10/09, Test Department,26/09/09 , 5:00 888001, Abhi, 2/10/09, Test Department,28/09/09 , 9:00 Intermediate XSLT: ----------------- I'm using this xslt which gives me the above output but don't have the date logic yet. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:param name="sep" select="', '"/> <xsl:param name="lf" select="' '"/> <xsl:template match="/"> <xsl:value-of select="concat('ID', $sep, 'Name', $sep,'Week Ending', $sep, 'Dept', $sep,'Work Date',$sep,'Reg Hours', $lf)"/> <xsl:for-each select="Result/Timesheet"> <xsl:if test="string(@Hours_Basic_Saturday) != '0.00'"> <xsl:value-of select="concat(ID, $sep, Name,$sep, Week_Ending_Date,$sep, Dept, $sep,'', $sep,Hours_Basic_Saturday,$lf)"/> </xsl:if> <xsl:if test="string(@Hours_Basic_Sunday) != '0.00'"> <xsl:value-of select="concat(ID, $sep, Name,$sep, Week_Ending_Date,$sep, Dept, $sep,'', $sep,Hours_Basic_Saturday, $lf)"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> Many Thanks, Abhilash Keep up with people you care about with Yahoo! India Mail. Learn how. http://in.overview.mail.yahoo.com/connectmore
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Complete Balisage 2009 Procee, B Tommie Usdin | Thread | RE: [xsl] How to implement date dif, Michael Kay |
[xsl] Complete Balisage 2009 Procee, B Tommie Usdin | Date | RE: [xsl] How to implement date dif, Michael Kay |
Month |