sort and merge question

admin

Administrator
Staff member
Hi,I have an XML source like this.<page><topic desc="his-topic"><item>i1</item><item>i2</item></topic><topic desc="another-topic"><item>i3</item><item>i4</item></topic><topic desc="his-topic"><item>i5</item><item>i6</item></topic></page>I want to merge <item>s under the two "his-topic"s.Also, I want to be able sort by topic/@desc (ie. I want"another-topic" to appear before "his-topic").The result should look like:<page><topic desc="another-topic"><item>i3</item><item>i4</item></topic><topic desc="his-topic"><item>i1</item><item>i2</item><item>i5</item><item>i6</item></topic></page>What I figured so far from the w3s and Microsoft documentation is:1) There is no XSLT facility to merge (which was an unpleasentsurprise to me)2) The xsl:sort will not work for a pattern like topic/@descon the <page>. And that I have to transform <topic @desc="xxx">...to <topic><name>xxx</name>... and sort on name.I may be wrong (and I honestly wish I am). But before I proceedin a direction driven by the above facts I want to validate myassumption with some one who knows it is right or wrong.Please help, thanksAaron
 
Back
Top