好的,所以我有我正在尝试更改的 XML 数据。我已经编写了 XSLT,但它并没有起到作用,我需要帮助找出它有什么问题。
这是我需要使用 XSLT 更改的 XML:
<?xml version='1.0' encoding='UTF-8'?>
<bb:Report_Data xmlns:bb="urn:com.playdate.report/Absence_Balances-Outbound">
<bb:Report_Entry>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:All_Eligible_Time_Off_Plans_for_Worker>
<bb:projectedBalanceTotal.planCodeId>Sick</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Sick</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
</bb:All_Eligible_Time_Off_Plans_for_Worker>
<bb:All_Eligible_Time_Off_Plans_for_Worker>
<bb:projectedBalanceTotal.planCodeId>Vacation</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Vacation</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>3.323077</bb:projected_balance_accrual_amount_for_the_pay_period>
</bb:All_Eligible_Time_Off_Plans_for_Worker>
<bb:All_Eligible_Time_Off_Plans_for_Worker>
<bb:projectedBalanceTotal.planCodeId>Winter Recess</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Winter Recess</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
</bb:All_Eligible_Time_Off_Plans_for_Worker>
<bb:projectedBalanceTotal.effectiveDate1>08122012</bb:projectedBalanceTotal.effectiveDate1>
<bb:projectedBalanceTotal.effectiveDate2>08262012</bb:projectedBalanceTotal.effectiveDate2>
<bb:projectedBalanceTotal.effectiveDate3>09092012</bb:projectedBalanceTotal.effectiveDate3>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</bb:Report_Entry>
</bb:Report_Data>
这就是我需要它的样子:
<?xml version='1.0' encoding='UTF-8'?>
<bb:Report_Data xmlns:bb="urn:com.playdate.report/Absence_Balances-Outbound">
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Sick</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Sick</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>08122012</bb:projectedBalanceTotal.effectiveDate>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Vacation</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Vacation</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>3.323077</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>08122012</bb:projectedBalanceTotal.effectiveDate>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Winter Recess</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Winter Recess</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>08122012</bb:projectedBalanceTotal.effectiveDate>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Sick</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Sick</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>08262012</bb:projectedBalanceTotal.effectiveDate
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Vacation</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Vacation</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>3.323077</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>08262012</bb:projectedBalanceTotal.effectiveDate
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Winter Recess</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Winter Recess</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>08262012</bb:projectedBalanceTotal.effectiveDate
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Sick</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Sick</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>09092012</bb:projectedBalanceTotal.effectiveDate>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Vacation</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Vacation</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>3.323077</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>09092012</bb:projectedBalanceTotal.effectiveDate>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
<projectedBalanceTotal>
<bb:projectedBalanceTotal.principalId>1040182074</bb:projectedBalanceTotal.principalId>
<bb:projectedBalanceTotal.planCodeId>Winter Recess</bb:projectedBalanceTotal.planCodeId>
<bb:projectedBalanceTotal.leaveDescription>Winter Recess</bb:projectedBalanceTotal.leaveDescription>
<bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
<bb:projectedBalanceTotal.effectiveDate>09092012</bb:projectedBalanceTotal.effectiveDate>
<bb:projectedBalanceTotal.employeeId>0260971</bb:projectedBalanceTotal.employeeId>
</projectedBalanceTotal>
</bb:Report_Data>
这是我正在使用的 XSLT,它没有起到作用:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wd="urn:com.playdate.report/Projected_Absence_Balances-Outbound">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<bb:Report_Data>
<xsl:apply-templates select="*/*/*/*[starts-with(local-name(),'projectedBalanceTotal.effectiveDate')]"/>
</bb:Report_Data>
</xsl:template>
<xsl:template match="*">
<projectedBalanceTotal>
<xsl:copy-of select="
../../bb:projectedBalanceTotal.principalId |
../bb:projectedBalanceTotal.planCodeId |
../bb:projectedBalanceTotal.leaveDescription |
../bb:projected_balance_accrual_amount_for_the_pay_period" />
<bb:projectedBalanceTotal.effectiveDate>
<xsl:value-of select="." />
</bb:projectedBalanceTotal.effectiveDate>
<xsl:copy-of select="../../bb:projectedBalanceTotal.employeeId" />
</projectedBalanceTotal>
</xsl:template>
</xsl:stylesheet>
如果我可以删除 WD 前缀也很好。任何帮助将不胜感激!!!!