
August 5th, 2011, 03:39 PM
|
|
Registered User
|
|
Join Date: Aug 2011
Posts: 8
Time spent in forums: 2 h 6 m 44 sec
Reputation Power: 0
|
|
|
Muenchian Method sorting by attribute
Hey all,
I've used the Muenchian Method for sorting and grouping but I've not had any success in using it to group by an attribute. I'm hoping someone here has had this experience and made it work.
Here's a node example from the xml...
Code:
<Products>
<itm num="123456">
<properties oid="3897936" cat="8" type="Stuff" series="My Series"/>
<legacy brand="MyOldBrand" oldNum="654321"/>
</itm>
</Products>
I'm needing to get a list of all the legacy/@brands that are in the data file
Here's the portion of xslt I've been attempting to do this with...
Code:
<xsl:key name="kProdByBrand" match="itm" use="legacy/@brand"/>
<xsl:template match="Products">
<xsl:for-each select="itm/legacy[generate-id() = generate-id(key('kProdByBrand', /@brand)[1])]"><xsl:sort select="/@brand" /><xsl:value-of select="/@brand" />|</xsl:for-each>
</xsl:template>
Any help would be appreciated.
Thanks!
|