我正在尝试将仅在其父元素内的子元素分组到它们自己的父分组中。
按 action/@publishForResources 分组,但在其自己的父元素操作中。
所以如果我有一个如下的 XML
<?xml version="1.0" encoding="UTF-8"?>
<ScheduleUpdates id_schedule="10" timestamp="2013-07-31T09:28:15.285+10:00" id_user="2" UserId="2" UserName="admin" caused-by="" CookiePGS="" CRBSTransactionID="2298">
<actions operation="insert">
<action id_action="207836" actionKindId="3" id_task="4094" publishForResources="855"/>
<action id_action="207824" actionKindId="3" id_task="4101" publishForResources="876"/>
<action id_action="207828" actionKindId="3" id_task="4098" publishForResources="876"/>
<action id_action="207817" actionKindId="3" id_task="4097" publishForResources="876"/>
<action id_action="207840" actionKindId="3" id_task="4095" publishForResources="855"/>
</actions>
<actions operation="update">
<action id_action="207836" actionKindId="3" id_task="2094" publishForResources="810"/>
<action id_action="207824" actionKindId="3" id_task="3101" publishForResources="872"/>
<action id_action="207828" actionKindId="3" id_task="3098" publishForResources="872"/>
<action id_action="207817" actionKindId="3" id_task="3097" publishForResources="872"/>
<action id_action="207840" actionKindId="3" id_task="3095" publishForResources="810"/>
</actions>
<actions operation="delete">
<action id_action="207836" actionKindId="3" id_task="2094" publishForResources="73"/>
<action id_action="207824" actionKindId="3" id_task="2101" publishForResources="55"/>
<action id_action="207828" actionKindId="3" id_task="2098" publishForResources="55"/>
<action id_action="207817" actionKindId="3" id_task="2097" publishForResources="73"/>
<action id_action="207840" actionKindId="3" id_task="2095" publishForResources="73"/>
</actions>
</ScheduleUpdates>
结果应该是
<?xml version="1.0" encoding="UTF-8"?>
<ScheduleUpdates id_schedule="10" timestamp="2013-07-31T09:28:15.285+10:00" id_user="2" UserId="2" UserName="admin" caused-by="" CookiePGS="" CRBSTransactionID="2298">
<actions operation="insert" publishForResources="876">
<action id_action="207824" actionKindId="3" id_task="4101" publishForResources="876"/>
<action id_action="207828" actionKindId="3" id_task="4098" publishForResources="876"/>
<action id_action="207817" actionKindId="3" id_task="4097" publishForResources="876"/>
</actions>
<actions operation="insert" publishForResources="855">
<action id_action="207836" actionKindId="3" id_task="4094" publishForResources="855"/>
<action id_action="207840" actionKindId="3" id_task="4095" publishForResources="855"/>
</actions>
<actions operation="update" publishForResources="810">
<action id_action="207836" actionKindId="3" id_task="2094" publishForResources="810"/>
<action id_action="207840" actionKindId="3" id_task="3095" publishForResources="810"/>
</actions>
<actions operation="update" publishForResources="872">
<action id_action="207824" actionKindId="3" id_task="3101" publishForResources="872"/>
<action id_action="207828" actionKindId="3" id_task="3098" publishForResources="872"/>
<action id_action="207817" actionKindId="3" id_task="3097" publishForResources="872"/>
</actions>
<actions operation="delete" publishForResources="73">
<action id_action="207836" actionKindId="3" id_task="2094" publishForResources="73"/>
<action id_action="207817" actionKindId="3" id_task="2097" publishForResources="73"/>
<action id_action="207840" actionKindId="3" id_task="2095" publishForResources="73"/>
</actions>
<actions operation="delete" publishForResources="55">
<action id_action="207824" actionKindId="3" id_task="2101" publishForResources="55"/>
<action id_action="207828" actionKindId="3" id_task="2098" publishForResources="55"/>
</actions>
</ScheduleUpdates>
我一直在琢磨 XSLT 1.0 分组/xsl:key 解决方案,但我似乎无法让它工作。
感谢一些帮助和指导。
谢谢你的帮助
大卫