This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
how to number on a grouped and sorted set?
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: how to number on a grouped and sorted set?
- From: Chad Small <chad dot small at definityhealth dot com>
- Date: Fri, 3 Nov 2000 16:53:41 -0400 (EST)
- Reply-To: xsl-list at mulberrytech dot com
I'm working with a group and sort set defined like this and just want to
write the order (number - 1,2,3,etc.) into the last element called <rank>.
How do I do that?
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="g" match="result" use="cuicode"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<ConceptResults>
<xsl:for-each
select="ConceptResults/result[generate-id(.)=generate-id(key('g',cuicode)[1]
)]">
<xsl:sort data-type="number" select="sum(key('g',cuicode)/bitmask)"
order="descending"/>
<xsl:sort data-type="number" select="key('g',cuicode)/count"
order="descending"/>
<xsl:sort data-type="number" select="key('g',cuicode)/offset"
order="descending"/>
<xsl:variable name="results-with-same-cuicode"
select="key('g',cuicode)"/>
<result>
<url><xsl:value-of select="url"/></url>
<offset><xsl:value-of select="offset"/></offset>
<phrase><xsl:value-of select="phrase"/></phrase>
<bitmask><xsl:value-of
select="sum($results-with-same-cuicode/bitmask)"/></bitmask>
<cui><xsl:value-of select="cui"/></cui>
<count><xsl:value-of select="count(key('g',cuicode))"/></count>
<cuicode><xsl:value-of select="cuicode"/></cuicode>
<cuidscr><xsl:value-of select="cuidscr"/></cuidscr>
<rank><xsl:number level="single" from="."/></rank>
<---------------------------------------- how do I get the grouped number
and not the original number
</result>
</xsl:for-each>
</ConceptResults>
</xsl:template>
</xsl:stylesheet>
thanks,
chad.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list