How to store the previous node value
i want to store the previous node(TaskEnd) value to variable so that m able to compare it with current node(TaskEnd).please help m in this.
this is my xml:
<NewDataSet>
<Detail>
<idShiftNo>71</idShiftNo>
<idEmployee>221364</idEmployee>
<NameEmployee>Biswal, Katrin</NameEmployee>
<Date>2007-01-05T00:00:00+05:30</Date>
<Department>1</Department>
<ShiftName>F25</ShiftName>
<ShiftStart>2007-01-05T06:15:00+05:30</ShiftStart>
<ShiftEnd>2007-01-05T14:00:00+05:30</ShiftEnd>
<idTaskNo>337</idTaskNo>
<strNameJob>C-4U</strNameJob>
<idTaskNo1>337</idTaskNo1>
<TaskStart>2007-01-05T06:15:00+05:30</TaskStart>
<TaskEnd>2007-01-05T08:15:00+05:30</TaskEnd>
<TaskName>C-4U</TaskName>
#000000
<backColorHTML>#C0C0C0</backColorHTML>
<ToolTip>RoutineJob:C-4U Task:C-4U Start: 06:15 End: 08:15</ToolTip>
</Detail>
<Detail>
<idShiftNo>72</idShiftNo>
<idEmployee>221265</idEmployee>
<NameEmployee>Biswal, Antje</NameEmployee>
<Date>2007-01-05T00:00:00+05:30</Date>
<Department>1</Department>
<ShiftName>F11</ShiftName>
<ShiftStart>2007-01-05T02:30:00+05:30</ShiftStart>
<ShiftEnd>2007-01-05T11:00:00+05:30</ShiftEnd>
<idTaskNo>324</idTaskNo>
<strNameJob>C-DE</strNameJob>
<idTaskNo1>324</idTaskNo1>
<TaskStart>2007-01-05T02:30:00+05:30</TaskStart>
<TaskEnd>2007-01-05T04:15:00+05:30</TaskEnd>
<TaskName>C-DE5824</TaskName>
#000000
<backColorHTML>#C0C0C0</backColorHTML>
<ToolTip>Flight: Job: C-DE Task:C-DE5824 STA: STD: 03:45 AcOP: DE AcType: 320 Dest: TFS
PaxMax: 174 PaxBkd: 176</ToolTip>
</Detail>
<Detail>
<idShiftNo>72</idShiftNo>
<idEmployee>221265</idEmployee>
<NameEmployee>Biswal, Antje</NameEmployee>
<Date>2007-01-05T00:00:00+05:30</Date>
<Department>1</Department>
<ShiftName>F11</ShiftName>
<ShiftStart>2007-01-05T02:30:00+05:30</ShiftStart>
<ShiftEnd>2007-01-05T11:00:00+05:30</ShiftEnd>
<idTaskNo>292</idTaskNo>
<strNameJob>BO</strNameJob>
<idTaskNo1>292</idTaskNo1>
<TaskStart>2007-01-05T04:15:00+05:30</TaskStart>
<TaskEnd>2007-01-05T04:55:00+05:30</TaskEnd>
<TaskName>DE5824</TaskName>
#000000
<backColorHTML>#C0C0C0</backColorHTML>
<ToolTip>Flight: Job: BO Task:DE5824 STA: STD: 03:45 AcOP: DE AcType: 320 Dest: TFS PaxMax:
174 PaxBkd: 176</ToolTip>
</Detail>
<NewDataSet>
xslt:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://whatever">
<xsl:key name="distinctShift" match="NewDataSet/Detail" use="./idShiftNo"/>
<xsl:variable name="timeendshow"></xsl:variable>
<xsl:variable name="timeendshow2"></xsl:variable>
<xsl:variable name="timeendshow1"></xsl:variable>
<xsl:variable name="timestartshow"></xsl:variable>
<xsl:variable name="taskname"></xsl:variable>
<xsl:variable name="taskname1"></xsl:variable>
<xsl:variable name="taskname2"></xsl:variable>
<xsl:variable name="taskmincal"></xsl:variable>
<xsl:variable name="timeendmin"></xsl:variable>
<xsl:variable name ="taskmatch"></xsl:variable>
<xsl:template match="NewDataSet/Detail[@type = 'idShiftNo']">
<NewDataSet>
<xsl:copy-of select="*" />
<xsl:copy-of select="following-sibling::NewDataSet/Detail[1]
[@type = 'TaskName']/*"/>
</NewDataSet>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="NewDataSet/Detail[generate-id() = generate-id(key('distinctShift', ./idShiftNo)[1])]">
<xsl:value-of select="idShiftNo"/>
<xsl:value-of select="ShiftName"/>
<xsl:value-of select="NameEmployee"/>
<xsl:value-of select="substring(ShiftStart,12,5)"/>
<xsl:value-of select="substring(ShiftEnd,12,5)"/>
<xsl:for-each select="/NewDataSet/Detail[idShiftNo = current()/idShiftNo]">
<xsl:value-of select="$taskname"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Inside the for-each loop for Task i want to store the previous value of the node(taskEnd)
Please help me :(
|