Im working with XSLT1.0 (Processor can't handle 2.0) and have a problem trying to group the output of an xml structure:
<row>
<order>
<text> some order text 1
</text>
</order>
</row>
<row>
<payment>
<text> some payment text 1
</text>
</payment>
</row>
<row>
<order>
<text> some order text 2
</text>
</order>
</row>
<row>
<contact>
<text> some contact details 1
</text>
</contact>
</row>
<row>
<contact>
<text> some contact details 2
</text>
</contact>
</row>
Today we select all rows and call apply template for each (each type has its own template that writes out its body), that creates an output like:
Order: some order text1
Order: some order text2
Payment: some payment text1
Contact: some contact details1
Contact: some contact details2
But what I would like is to (in XSLT 1.0) to group the output so that:
Order
- some order text1
- some order text2
Payment
- some payment text1
Contact
- some contact details1
- some contact details2
Obviously there are many other element types than order,payment and contact involved here so selecting by explicit element names is not a solution.
EDIT
Ty, some great answers, how would the Muenchian grouping solution change if I had a structure of say
<customers>
<person>
<row>....</row> (row is same as above)
<row>....</row>
</person>
<person>
<row>....</row>
<row>....</row>
<row>....</row>
</person>
Then the key:
<xsl:key name="type" match="row/*" use="local-name()"/>
Would select all rows across all persons which is not what I wanted. Thanks for great responses too.