Subject: [xsl] effiecient use of keys From: x y <milkmandeg@xxxxxxxxx> Date: Fri, 17 May 2002 03:48:19 -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))" /> ??? </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] Using regular expressions, Joerg Heinicke | Thread | [xsl] some help with xsl:if, Gabriel C Millerd |
Re: [xsl] xsl:value-of not allowed , Jeni Tennison | Date | RE: [xsl] Variable confusion, Tompkins Tim |
Month |