这是我开始的 XML:
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Sick</leaveDescription>
<leaveCodeStr>SS</leaveCodeStr>
<balanceAmount>90.22</balanceAmount>
<leaveDescription>Vacation</leaveDescription>
<leaveCodeStr>VA</leaveCodeStr>
<balanceAmount>187.11</balanceAmount>
<leaveDescription>Winter Recess</leaveDescription>
<leaveCodeStr>WR</leaveCodeStr>
<balanceAmount>30</balanceAmount>
<effectiveDate>03/11/2013 23:59:59</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>03/11/2013 23:59:59</lastPayEndDate>
</leaveBalanceTotal>
我正在使用此 XSLT 将其转换为我需要的格式:
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xtt="urn:com.workday/xtt"
xmlns:etv="urn:com.workday/etv"
xmlns:wd="urn:com.workday.report/CR-INT486-Kuali_Trojan_Time-Absence_Balances-Outbound"
exclude-result-prefixes="wd xsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<document>
<xsl:for-each select="wd:Report_Data/wd:Report_Entry/wd:All_Eligible_Time_Off_Plans_for_Worker">
<leaveBalanceTotal>
<employeeId><xsl:value-of select="parent::node()/wd:employeeId"/></employeeId>
<uscId><xsl:value-of select="parent::node()/wd:uscId"/></uscId>
<leaveCodeId><xsl:value-of select="wd:leaveCodeStr"/></leaveCodeId>
<balanceAmount><xsl:value-of select="wd:balanceAmount"/></balanceAmount>
<effectiveDate><xsl:value-of select="parent::node()/wd:effectiveDate"/></effectiveDate>
<totalDaysService><xsl:value-of select="parent::node()/wd:totalDaysService"/></totalDaysService>
<lastPayEndDate><xsl:value-of select="parent::node()/wd:lastPayEndDate"/></lastPayEndDate>
</leaveBalanceTotal>
</xsl:for-each>
</document>
</xsl:template>
</xsl:stylesheet>
这是我得到的输出:
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Sick</leaveDescription>
<leaveCodeStr>SS</leaveCodeStr>
<balanceAmount>90.22</balanceAmount>
<effectiveDate>03/11/2013 23:59:59</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>03/11/2013 23:59:59</lastPayEndDate>
</leaveBalanceTotal>
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Vacation</leaveDescription>
<leaveCodeStr>VA</leaveCodeStr>
<balanceAmount>187.11</balanceAmount>
<effectiveDate>03/11/2013 23:59:59</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>03/11/2013 23:59:59</lastPayEndDate>
</leaveBalanceTotal>
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Winter Recess</leaveDescription>
<leaveCodeStr>WR</leaveCodeStr>
<balanceAmount>30</balanceAmount>
<effectiveDate>03/11/2013 23:59:59</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>03/11/2013 23:59:59</lastPayEndDate>
</leaveBalanceTotal>
但是,我需要像这样将两个日期字段转换为 UNIX 毫秒,并将日期转换为 UNIX 毫秒:
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Sick</leaveDescription>
<leaveCodeStr>SS</leaveCodeStr>
<balanceAmount>90.22</balanceAmount>
<effectiveDate>1363060799000</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>1363060799000</lastPayEndDate>
</leaveBalanceTotal>
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Vacation</leaveDescription>
<leaveCodeStr>VA</leaveCodeStr>
<balanceAmount>187.11</balanceAmount>
<effectiveDate>1363060799000</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>1363060799000</lastPayEndDate>
</leaveBalanceTotal>
<leaveBalanceTotal>
<employeeId>0001234</employeeId>
<uscId>1234567894654</uscId>
<leaveDescription>Winter Recess</leaveDescription>
<leaveCodeStr>WR</leaveCodeStr>
<balanceAmount>30</balanceAmount>
<effectiveDate>1363060799000</effectiveDate>
<totalDaysService>6062</totalDaysService>
<lastPayEndDate>1363060799000</lastPayEndDate>
</leaveBalanceTotal>
基本上我希望有人能告诉我如何转换这些日期。任何帮助,将不胜感激。