I wanted to see if it’s possible to use xslt to sort an xml document in an order specified by another document. It is, but I’m not satisfied with my solution yet.
The problem is it takes too many iterations to sort in that order. I have to loop through the sortOrder document and then loop through the context document for each node. I should be able to just look up a node by some value. Those of you who know XSLT will say “of course you can look up a node by its name! That’s what xsl:key is for!”
You’d be right, too, except for the fact that to do this sort requires a loop over the sortOrder document, and inside the scope of that loop you cannot access the key! doh!
Anyway, I’m still thinking about this, but I’d love to hear it if anyone comes up with a solution. Just post it in a forum somewhere and I’ll find it. 😉