0
如何根據InfoNo
屬性先排序xml,然後使用xsl使用模板排序SeqNo
屬性。我試着在XSL但我只能在一個屬性做根據兩個屬性排序
輸入XML:
<Customer>
<Info InfoNo="2" SeqNo="1" >
<LastName>Wilson</LastName>
<GivenName>Kelley</GivenName>
</Info>
<Info InfoNo="4" SeqNo="1" >
<LastName>Graham</LastName>
<GivenName>Tom</GivenName>
</Info>
<Info InfoNo="1" SeqNo="3" >
<LastName>Fisher</LastName>
<GivenName>Elaine</GivenName>
</Info>
<Info InfoNo="1" SeqNo="2" ">
<LastName>Gary</LastName>
<GivenName>Jerry</GivenName>
</Info>
<Info InfoNo="1" SeqNo="1" >
<LastName>Timothy</LastName>
<GivenName>Kathy</GivenName>
</Info>
<Info InfoNo="3" SeqNo="1" >
<LastName>Tim</LastName>
<GivenName>Kerry</GivenName>
</Info>
<Info InfoNo="1" SeqNo="4" >
<LastName>Rob</LastName>
<GivenName>Tony</GivenName>
</Info>
</Customer>
預期輸出XML:
<Customer>
<Info InfoNo="1" SeqNo="1" >
<LastName>Timothy</LastName>
<GivenName>Kathy</GivenName>
</Info>
<Info InfoNo="1" SeqNo="2" ">
<LastName>Gary</LastName>
<GivenName>Jerry</GivenName>
</Info>
<Info InfoNo="1" SeqNo="3" >
<LastName>Fisher</LastName>
<GivenName>Elaine</GivenName>
</Info>
<Info InfoNo="1" SeqNo="4" >
<LastName>Rob</LastName>
<GivenName>Tony</GivenName>
</Info>
<Info InfoNo="2" SeqNo="1" >
<LastName>Wilson</LastName>
<GivenName>Kelley</GivenName>
</Info>
<Info InfoNo="3" SeqNo="1" >
<LastName>Tim</LastName>
<GivenName>Kerry</GivenName>
</Info>
<Info InfoNo="4" SeqNo="1" >
<LastName>Graham</LastName>
<GivenName>Tom</GivenName>
</Info>
</Customer>
需要它xslt1.0
「我試過xsl,但我只能做一個屬性」:那麼爲什麼你不能寫兩個'xsl:sort'呢? –