我是XSLT新手,正在努力解決以下轉型問題。XSl - 需要轉型幫助
我有一個看起來像這樣的XML ...
<Groups>
<Group>
<GroupSelector>52</GroupSelector>
<GroupDescription>Group 52</GroupDescription>
<GroupValue>ABCD</GroupValue>
</Group>
<Group>
<GroupSelector>27</GroupSelector>
<GroupDescription>Group 27</GroupDescription>
<GroupValue>PQRS</GroupValue>
</Group>
<Group>
<GroupSelector>20</GroupSelector>
<GroupDescription>Group 20</GroupDescription>
<GroupValue>XYZA</GroupValue>
</Group>
<Group>
<GroupSelector>15</GroupSelector>
<GroupDescription>Group 15</GroupDescription>
<GroupValue>MNOP</GroupValue>
</Group>
</Groups>
有可能是0到n個「集團
我試圖使用XSLT找到一個‘集團’,其中'GroupSelector'的值是20並且像這樣創建輸出;
<GroupSelection ElementName="FoundGroup" Missing="false">20</GroupSelection>
<GroupSelection ElementName="GroupDes" Missing="false">Group 20</GroupSelection>
<GroupSelection ElementName="GroupVal" Missing="false">XYZA</GroupSelection>
如果沒有在n「集團的具有‘GroupSelector’具有值20,輸出應該是這樣;
<GroupSelection ElementName="FoundGroup" Missing="true"/>
<GroupSelection ElementName="GroupDes" Missing="true"/>
<GroupSelection ElementName="GroupVal" Missing="true"/>
請幫忙。提前致謝。
蘿拉
好問題,+1。請參閱我的答案,獲取簡短而簡單的解決方案。 :) –