[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: job for xsl:key? (XSL 1.0 question)
Applying this I'm stumped. In my version I am parsing nodes with class='placed'. You will notice in the $EMP XML there are 1 type 2s and 5 type 3s. But the below XML only returns 1101 (only counts the 1 type=2). If I change the '1' in generate-id(key('by-type', @type)[1]) to '2', it counts the 5 type=3's XML contents of $EMP <Records> <Record> <type>1</type> <class>unplaced</class> <count>3</count> </Record> <Record> <type>2</type> <class>placed</class> <count>1</count> </Record> <Record> <type>2</type> <class>unplaced</class> <count>8</count> </Record> <Record> <type>3</type> <class>met45</class> <count>1</count> </Record> <Record> <type>3</type> <class>placed</class> <count>5</count> </Record> <Record> <type>3</type> <class>unplaced</class> <count>14</count> </Record> </Records> XML contents of $types <vrType> <option value="1" benchmark1="540.00" benchmark2="540.00" benchmark3="720.00" /> <option value="2" benchmark1="1101.00" benchmark2="1101.00" benchmark3="1468.00" /> <option value="3" benchmark1="1801.50" benchmark2="1801.50" benchmark3="2402.00" /> </vrType> XSL----- <td> <xsl:variable name="rtfm"> <xsl:for-each select="$EMP[class='placed' and generate-id() = generate-id(key('byType',type)[1])]"> <temp> <xsl:value-of select="sum(key('byType',current()/type)[class='placed']/count) * $types/option[@value=current()/type]/@benchmark1" /></temp> </xsl:for-each> </xsl:variable> $<xsl:value-of select="sum(msxsl:node-set($rtfm)/temp)" /> </td> On 2/20/07, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote: Here is another possible solution (using node-set extension function):
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|