I was looking at the Muenchian method for grouping with xslt,
The data is similar to this
<Root>
<Entries>
<Entry Attribute="A"/>
<Entry Attribute="B"/>
<Entry Attribute="C"/>
</Entries>
</Root>
But in addition I needed to have a predefined sort order - on atttributes of my elements. So I was looking at having a custom xml section in the xslt with sort order and inserting it into a variable something like this
<xsl:variable name="sortorder"select="document('')/*/my:data/my:ordering/my:value"/>
Values being e.g. C, B, A which is order and also grouping header
Then it occured to me that instead of using the key() function in the Muenchian method, I could simply loop through the values of the variable.
Like this
<xsl:template match="Entries">
<xsl:for-each select="$sortorder/value">
<groupheader><xsl:value-of select="."/></groupheader>
... and then apply templates
<xsl:apply-templates select="Entry[@sortattribute=current()"></xsl:apply-templates>
But I havent gotten it to work. Any tips on how to achieve this? Am I on the right track? I suspect that I am throwing the processor off with the looping over the variable in the context of the <Entry>s but I don't know how to correct it.