我有以下xml:
<?xml version="1.0" encoding="utf-8"?>
<peci:Worker_Effective_Stack_Aggregate xmlns:peci="urn:com.workday/peci">
<peci:Workers_Effective_Stack xmlns:peci="urn:com.workday/peci">
<peci:Summary>
<peci:Integration_Event>6d374dcbe3a81024090d271cab840000</peci:Integration_Event>
</peci:Summary>
<peci:Worker>
<peci:Worker_Summary>
<peci:Employee_ID>328556</peci:Employee_ID>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>HIR</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-27T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-27T03:24:11.531-07:00</peci:Entry_Moment>
</peci:Effective_Change>
<peci:Effective_Change peci:Sequence="1">
<peci:Derived_Event_Code>DTA</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-27T03:30:05.861-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-27T03:30:05.861-07:00</peci:Entry_Moment>
</peci:Effective_Change>
</peci:Worker>
<peci:Worker>
<peci:Worker_Summary>
<peci:Employee_ID>328557</peci:Employee_ID>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>HIR</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-27T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-27T04:44:30.864-07:00</peci:Entry_Moment>
</peci:Effective_Change>
</peci:Worker>
<peci:Worker>
<peci:Worker_Summary>
<peci:Employee_ID>1111132</peci:Employee_ID>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>DTA</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-25T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-25T04:44:30.864-07:00</peci:Entry_Moment>
</peci:Effective_Change>
</peci:Worker>
</peci:Workers_Effective_Stack>
</peci:Worker_Effective_Stack_Aggregate>我想得到这样的信息(只有员工有“雇佣”事件,只有“雇用”事件):
<?xml version="1.0" encoding="UTF-8"?>
<peci:Worker_Effective_Stack_Aggregate xmlns:peci="urn:com.workday/peci">
<peci:Workers_Effective_Stack>
<peci:Summary>
<peci:Integration_Event>6d374dcbe3a81024090d271cab840000</peci:Integration_Event>
</peci:Summary>
<peci:Worker>
<peci:Worker_Summary>
<peci:Employee_ID>328556</peci:Employee_ID>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>HIR</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-27T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-27T03:24:11.531-07:00</peci:Entry_Moment>
</peci:Effective_Change>
</peci:Worker>
<peci:Worker>
<peci:Worker_Summary>
<peci:Employee_ID>328557</peci:Employee_ID>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>HIR</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-27T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-27T04:44:30.864-07:00</peci:Entry_Moment>
</peci:Effective_Change>
</peci:Worker>
</peci:Workers_Effective_Stack>
</peci:Worker_Effective_Stack_Aggregate>这是我的密码
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:peci="urn:com.workday/peci">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match='peci:Effective_Change[peci:Derived_Event_Code != "HIR"]'/>
</xsl:stylesheet>不幸的是,如果没有HIR事件代码(最后一个),它不会删除工作程序。我试着加了这个
<xsl:template match="peci:Worker[peci:Effective_Change/peci:Derived_Event_Code!='HIR']"/>但是它删除了第一个工作人员(还有两个事务)。
提前感谢
普泽梅克
发布于 2022-08-01 13:55:42
好吧,我需要
<xsl:template match="peci:Worker[not(peci:Effective_Change/peci:Derived_Event_Code='HIR')]"/>但谁能解释一下原因吗?
https://stackoverflow.com/questions/73194514
复制相似问题