i need some help with sorting xmlelements based on another xml. my main xml is as below
<xml>
<A1>value</A1>
<A2>value</A2>
<B1>value</B1>
<B2>value</B2>
</xml>
i want another xml which looks liks this
<xml>
<A1>value</A1>
<B1>value</B1>
<A2>value</A2>
<B2>value</B2>
</xml>
sortign is not based on any key or any value. the ordering is determined on the fly(by reading the order from DB) and the main xml has to be transposed to that order. from db values are like
tagname | order
------------
A1 | 1
B1 | 2
A2 | 3
A3 | 4
how do i do this? i can form the xslt dynamically. but what should that xslt be?
Thanks in advance.
<elem name="A1" order="1"/>?