2
我需要一個xsl,它可以從任何「object_name」中獲取「item_revision_id」的最大值。 從這個輸入........xslt挑選組中的最大值
<rows>
<row>
<row_element property_name="object_name">pluto</row_element>
<row_element property_name="description">description of version 00</row_element>
<row_element property_name="item_revision_id">00</row_element>
</row>
<row>
<row_element property_name="object_name">pluto</row_element>
<row_element property_name="description">description of version 01</row_element>
<row_element property_name="item_revision_id">01</row_element>
</row>
<row>
<row_element property_name="object_name">pippo</row_element>
<row_element property_name="description">description of version 02</row_element>
<row_element property_name="item_revision_id">02</row_element>
</row>
<row>
<row_element property_name="object_name">pippo</row_element>
<row_element property_name="description">description of version 00</row_element>
<row_element property_name="item_revision_id">00</row_element>
</row>
</rows>
所需的輸出是
<?xml version="1.0" encoding="Windows-1252"?>
<rows>
<row>
<row_element property_name="object_name">pluto</row_element>
<row_element property_name="description">description of version 01</row_element>
<row_element property_name="item_revision_id">01</row_element>
</row>
<row>
<row_element property_name="object_name">pippo</row_element>
<row_element property_name="description">description of version 02</row_element>
<row_element property_name="item_revision_id">02</row_element>
</row>
</rows>
我想要得到的最大行元素不是創建一個新的混合值
<?xml version="1.0" encoding="Windows-1252"?>
<rows>
<row><!-- this is right -->
<row_element property_name="object_name">pluto</row_element>
<row_element property_name="description">description of version 01</row_element>
<row_element property_name="item_revision_id">01</row_element>
</row>
<row><!-- this is wrong -->
<row_element property_name="object_name">pippo</row_element>
<row_element property_name="description">description of version 00</row_element>
<row_element property_name="item_revision_id">02</row_element>
</row>
</rows>
有幫助嗎?
偉大的答案謝謝。 – user2217858
我看到一個副作用,說明我沒有做出正確的問題..: – user2217858
我看到一個副作用,這解釋了我沒有做出正確的問題..:我確實想要「選擇」具有最高「」 item_revision_id「。如果我有另一個row_element與property_name = descritption我證實,在結果有時不會複製來自最新修訂的一個。我該如何應對? –
user2217858