Subject: RE: [xsl] Hash-Table in xsl? From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Sat, 22 Feb 2003 14:42:49 -0000 |
Think of <xsl:key> as defining a hash table. Your problem is a classic grouping problem, and Muenchian grouping solves it using xsl:key, which will usually be implemented using a hash table behind the scenes. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Pankaj Shinde > Sent: 22 February 2002 12:27 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Hash-Table in xsl? > > > Hi, > > Can one create a hash table some how in xsl? > > My input xml : > -------------- > > <?xml version="1.0" encoding="ISO-8859-1"?> > <wrapper> > <data> > <company>company1</company> > <commodity>commodity1</commodity> > <units>11</units> > </data> > <data> > <company>company2</company> > <commodity>commodity2</commodity> > <units>22</units> > </data> > <data> > <company>company1</company> > <commodity>commodity3</commodity> > <units>13</units> > </data> > <data> > <company>company2</company> > <commodity>commodity1</commodity> > <units>21</units> > </data> > </wrapper> > > My output html : > ---------------- > > > Company1 > Company2 > > Commodity1 > 11 > 21 > > Commodity2 > > 22 > > Commodity3 > 13 > > > > > > > My Logic : > ---------- > > for each data node > if value of company has not been seen earlier > create new column with value of company as heading for that column > if value of commodity has not been seen earlier > create new row with value of commodity as heading for that row > put value of commodity in correct place. > else > if value of commodity has not been seen earlier > create new row with value of commodity as heading for that row > put value of commodity in correct place. > > Problem : > --------- > 1. I can use preceding-sibling for checking whether "value of > company is new" or "value of commodity is new". But this > screws up performance for large xmls. 2. I can use > java.util.Hashtable from within my xsl. How will this affect > my performance. 3. Can Meunchian be modified for this problem? > > Any help is appreciated. > > regards, > <panx/> > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Hash-Table in xsl?, Oleg Tkachenko | Thread | Re: [xsl] Can one _generate_ namesp, G. Ken Holman |
RE: [xsl] Running both Saxon and Xa, Américo Albuquerque | Date | RE: [xsl] Hash-Table in xsl?, Michael Kay |
Month |