I've tried several of the solutions that I've found here, but none seem to work on the model that I'm using. In my example XML, I'm trying to sort the mixed up chapters, into their proper sequence.
Source XML:
<?xml version="1.0" encoding="utf-8"?>
<library>
<book>
<title>A Fascinating Tale</title>
<chapter num="4">
<text>...and rambles to the end.</text>
</chapter>
<chapter num="2">
<text>The hero would...</text>
</chapter>
<chapter num="3">
<text>This went rambling on...</text>
</chapter>
<chapter num="1">
<text>Once upon a time...</text>
</chapter>
</book>
</library>
Should result in:
<?xml version="1.0" encoding="utf-8"?>
<library>
<book>
<title>A Fascinating Tale</title>
<chapter num="1">
<text>Once upon a time...</text>
</chapter>
<chapter num="2">
<text>The hero would...</text>
</chapter>
<chapter num="3">
<text>This went rambling on...</text>
</chapter>
<chapter num="4">
<text>...and rambles to the end.</text>
</chapter>
</book>
</library>
So from the stylesheet solutions I've found here, I can't get any to work. Am I making this too difficult? It seems like it should be fairly straightforward.