出现以下错误:
未为类型的参数定义算术运算符 (xs:dateTime, xs:string)
谁能帮我解决这个问题? 我正在尝试进行缺席更改。
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:this="urn:this"
xmlns:is="java:com.workday.esb.intsys.xpath.ParsedIntegrationSystemFunctions"
xmlns:tv="java:com.workday.esb.intsys.TypedValue" xmlns:wd="urn:com.workday/bsvc"
xmlns:bsvc="urn:com.workday/bsvc" exclude-result-prefixes="xs is tv wd bsvc"
version="2.0">
<xsl:variable name="linefeed" select="'
'" />
<xsl:output method="text" />
<xsl:template match="/">
<xsl:variable name="StdHoursMultiplier" select="26" />
<xsl:if
test="wd:Payee/wd:Payee_Status_Data/wd:Terminated = '0' and not(wd:Payee/wd:Payee_Status_Data/wd:Leave_Status_Data/wd:On_Leave = '1') and not(exists(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type = 'Contingent_Worker_ID']))">
<xsl:if
test="wd:Payee/wd:Payee_Job_Data/wd:Payee_Employment_Data/wd:Position_Data/wd:Job_Exempt != '0'">
<xsl:value-of select="this:right-padding(5,' ','TW')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ','RGL')" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','H')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<xsl:value-of
select="this:left-padding(8,' ',format-number((number(wd:Payee/wd:Payee_Job_Data/wd:Payee_Employment_Data/wd:Position_Data/wd:Scheduled_Weekly_Hours)*52) div $StdHoursMultiplier,'####.00') )" />
<!-- line feed -->
<xsl:value-of select="$linefeed" />
</xsl:if>
</xsl:if>
<xsl:for-each
select="//wd:Payee_Earnings_and_Deductions_Summary_Data/wd:Payee_One_Time_Payments_Summary_Data/wd:Payee_One_Time_Payment_Summary_Data/wd:Payee_One_Time_Payment_Data">
<xsl:value-of select="this:right-padding(5,' ','SP')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(/wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ',../wd:External_Payroll_Code)" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','D')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<xsl:value-of
select="this:left-padding(10,' ',format-number(sum(wd:Amount/wd:Value),'####.00'))" />
<!-- line feed -->
<xsl:value-of select="$linefeed" />
</xsl:for-each>
<xsl:if
test="wd:Payee/wd:Payee_Status_Data/wd:Terminated = '0' and (wd:Payee/wd:Payee_Status_Data/wd:Leave_Status_Data/wd:On_Leave = '1') and not(exists(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type = 'Contingent_Worker_ID']))">
<xsl:if
test="wd:Payee/wd:Payee_Job_Data/wd:Payee_Employment_Data/wd:Position_Data/wd:Job_Exempt != '0'"
exclude-result-prefixes="#all">
<xsl:choose>
<xsl:when
test="wd:Payee//wd:Payee_Status_Data/wd:Leave_Status_Data/wd:Paid_Time_off_Accrual_Effect = '1'">
<xsl:value-of select="this:right-padding(5,' ','TW')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ','RGL')" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','H')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<xsl:variable name="LeaveHours"
select="xs:dateTime(wd:Payee/wd:Payee_Status_data/wd:leave_Status_Data/wd:Estimated_Leave_End_Date) - xs:dateTime(wd:Payee/wd:Payee_Status_data/wd:leave_Status_Data/wd:Leave_Start_Date)cast as xs:string" />
<!-- amount -->
<xsl:value-of
select="this:left-padding(8,' ', '80')" />
<!-- line feed -->
<xsl:value-of select="$linefeed" />
<xsl:value-of select="this:right-padding(5,' ','TW')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ','SDP')" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','H')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<!-- amount -->
<xsl:value-of
select="this:left-padding(8,' ',format-number(number(substring-before(substring-after($LeaveHours,'P'),'D')),'####.00'))" />
</xsl:when>
<xsl:when
test="not(wd:Payee//wd:Payee_Status_Data/wd:Leave_Status_Data/wd:Paid_Time_off_Accrual_Effect = '1')">
<xsl:value-of select="this:right-padding(5,' ','TW')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ','RGL')" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','H')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<!-- amount -->
<!-- amount -->
<xsl:variable name="LeaveHours"
select="xs:dateTime(wd:Payee/wd:Payee_Status_data/wd:leave_Status_Data/wd:Estimated_Leave_End_Date) - xs:dateTime(wd:Payee/wd:Payee_Status_data/wd:leave_Status_Data/wd:Leave_Start_Date) cast as xs:string" />
<xsl:value-of
select="this:left-padding(8,' ',format-number(number(substring-before(substring-after($LeaveHours,'P'),'D')),'####.00' ))" />
<!-- line feed -->
<xsl:value-of select="$linefeed" />
<xsl:value-of select="this:right-padding(5,' ','TW')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ','SDP')" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','H')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<!-- amount -->
<xsl:value-of select="this:left-padding(8,' ','0')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="this:right-padding(5,' ','TW')" />
<!-- employee id -->
<xsl:value-of
select="this:right-padding(11,' ',substring(wd:Payee/wd:Payee_Reference/wd:ID[@wd:type='Employee_ID']/text(),3,6))" />
<!-- earning code -->
<xsl:value-of select="this:right-padding(6,' ','SDP')" />
<!-- amount type -->
<xsl:value-of select="this:right-padding(4,' ','H')" />
<!-- text -->
<xsl:value-of select="this:right-padding(7,' ','1')" />
<!-- amount -->
<xsl:value-of
select="this:left-padding(8,' ',format-number((number(wd:Payee/wd:Payee_Job_Data/wd:Payee_Employment_Data/wd:Position_Data/wd:Scheduled_Weekly_Hours)*52) div $StdHoursMultiplier,'####.00') )" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- line feed -->
<xsl:value-of select="$linefeed" />
</xsl:if>
</xsl:template>
<xsl:function name="this:right-padding">
<xsl:param name="length" as="xs:integer" />
<xsl:param name="padChar" as="xs:string" />
<xsl:param name="stringToPad" />
<xsl:sequence
select="substring(string-join(($stringToPad, for $i in (1 to $length) return $padChar),''),1,$length)" />
</xsl:function>
<xsl:function name="this:left-padding" as="xs:string">
<xsl:param name="length" as="xs:integer" />
<xsl:param name="padChar" as="xs:string" />
<xsl:param name="stringToPad" />
<xsl:choose>
<xsl:when test="string-length($stringToPad) > $length">
<xsl:sequence
select="substring($stringToPad, string-length($stringToPad) - $length + 1, $length)" />
</xsl:when>
<xsl:otherwise>
<xsl:sequence
select="substring(string-join((for $i in (1 to $length - string-length($stringToPad)) return $padChar, $stringToPad),''),1,$length)" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>
代码<xsl:variable name="LeaveHours"
select="xs:dateTime(wd:Payee/wd:Payee_Status_data/wd:leave_Status_Data/wd:Estimated_Leave_End_Date) - xs:dateTime(wd:Payee/wd:Payee_Status_data/wd:leave_Status_Data/wd:Leave_Start_Date)cast as xs:string" />
应该会导致该错误。只需删除尾随cast as xs:string
,这样您就可以使用减号运算符减去两个xs:dateTime
值-
就可以了,并获得一个可以根据需要进一步处理的持续时间值。