I want to create a alphabetically ordered list from an xml file. In the Xml file I have many <index-elements>
which should be part of the list, I simply select them all by //index-elements
. I also want to add another kind of elements, called <name>
, to the same list at theire right position (alphabetically sorted). Usually I use the <xsl:for-each-group group-by="..." select="...">
loop in combination with the <xsl:sort lang="lang-code">
function, but I cannot select for more than one node-set. This is the first time, where I need to add, two different elements in one sorted result. At the moment I've no Idea how to solve this.
XML
<section>
<child>
<index-elements>Gamma</index-elements>
</child>
<child>
<index-elements>Zeta</index-elements>
</child>
</section>
<section>
<child>
<index-elements>Alpha</index-elements>
</child>
<child>
<new-element>
<index-elements>Delta</index-elements>
</new-element>
</child>
</section>
<section>
<some-element>
<name>Epsilon</name>
</some-element>
<some-element>
<name>Beta</name>
</some-element>
</section>
Expected Output
Alpha
Beta
Gamma
Delta
Epsilon
Zeta