Subject: [xsl] one key or a whole bunch? From: Marina Sorreta <milkmandeg@xxxxxxxxx> Date: Tue, 21 May 2002 01:25:28 -0700 (PDT) |
Hello, I am looking for the most efficient way to use keys to do the following. My xml sample below:- <SHOP> <SPORTS> ..... <--- other stuff ..... <SHELF_NO>4567</SHELF_NO> ..... </SPORTS> <LEISURE> ..... ..... <SHELF_NO>3344</SHELF_NO> ..... </LEISURE> <CLOTHES> ..... ..... <SHELF_NO>3344</SHELF_NO> ..... </CLOTHES> <GIFTS> ..... ..... <SHELF_NO>3344</SHELF_NO> ..... </GIFTS> </SHOP> I need to get a count of all the groups of <SHELF_NO>'s that are the same. I need the output to be in the form (with the example above):- Shelf Groups Number of Copies 0 0 <--i.e. no instance of no shelf number 1 1 <--i.e. 1 instance of just one unique shelf number 2 0 <--i.e no instance of two shelf numbers the same 3 1 <--i.e. 1 instance where three shelf numbers were the same etc etc So is the best way to have a key like: - <xsl:key name="kShelf" match="SPORTS | LEISURE | CLOTHES | GIFTS" use="SHELF_NO"/> and a variable say <xsl:variable name="vShelf" select="SHOP/*[generate-id() = generate-id(key('kShelf', SHELF_NO )[1] ) ]"/> Then I get stuck as to how to iterate over them and count the groups. Something like? <xsl:for-each select="$vShelf"> <xsl:value-of select="count(key('kShelf', SHELF_NO))" /> ??? just once or for all groups? </xsl:for-each> Any help gratefully received. Thanks Marina __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] NullPointerException, Wendell Piez | Thread | Re: [xsl] one key or a whole bunch?, Jeni Tennison |
RE: [xsl] NullPointerException, Michael Kay | Date | [xsl] variable nodelist travarse h, Tareq Rahman |
Month |