I'm a newbie in XSLT. I just come up with a question and hope someone can help.
Assume I have a source xml,
<?xml version="1.0"?>
<docroot>
<vc6>foo</vc6>
<vc7>bar7</vc7>
<vc8 arch="x64">amd64demo</vc8>
<vc7>foo7</vc7>
<vc6>bar</vc6>
</docroot>
I'd like to turn it into:
<?xml version="1.0"?>
<docroot>
<vc6>bar</vc6>
<vc6>foo</vc6>
<vc7>bar7</vc7>
<vc7>foo7</vc7>
<vc8 arch="x64">amd64demo</vc8>
</docroot>
that is,
- child elements of should be sorted by element name, so
<vc6
> comes before<vc7
> . - If two children have the same element name, they should be sorted by their text value, so 'bar' is ahead of 'foo'.
How to write the xsl? Thank you.