[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Getting html table cell values based on the table heading
Subject: [xsl] Getting html table cell values based on the table heading From: "Karl Funk" <Karl.Funk@xxxxxxxxxxxx> Date: Thu, 1 Jul 2010 06:01:33 -0600 (MDT) |
Hi, Firstly I would like to do this as an xpath expression, if this is an inappropriate question for this forum then I apologise, but would like to see an XSL equivalent also. The data is like this... <table border="1" width="500"> <tbody> <tr> <th class="awrbg">DB Name</th> <th class="awrbg">DB Id</th> <th class="awrbg">Instance</th> <th class="awrbg">Inst num</th> <th class="awrbg">Release</th> <th class="awrbg">RAC</th> <th class="awrbg">Host</th> </tr> <tr> <td class="awrnc">SFDB</td> <td class="awrnc" align="right">3911180340</td> <td class="awrnc">atlsfdb</td> <td class="awrnc" align="right">1</td> <td class="awrnc">10.2.0.5.0</td> <td class="awrnc">NO</td> <td class="awrnc">sfd02</td> </tr> </tbody> </table> I would like to be able to construct a single xpath expression which supplies the "index" e.g. "DB Name" which is on path /table/tbody/tr[1]/th[1] and returns the value from the corresponding nth row in this case the second tr of the same /table/tbody so the value "SFDB". Input of "Host" returns "sfd02" . etc. Then I would like to extend this to cover tables with any number of rows (and an inconsistency in the use of "th" and "tr" for headings) e.g. <table border="1"> <tbody> <tr> <th class="awrbg">Wait Class</th> <th class="awrbg">Waits</th> <th class="awrbg">%Time -outs</th> <th class="awrbg">Total Wait Time (s)</th> <th class="awrbg">Avg wait (ms)</th> <th class="awrbg">%Total Call Time</th> </tr> <tr> <td class="awrc">Application</td> <td class="awrc" align="right">625,444</td> <td class="awrc" align="right"/> <td class="awrc" align="right">31,580</td> <td class="awrc" align="right">50</td> <td class="awrc" align="right">53.03</td> </tr> <tr> <td class="awrnc">CPU time</td> <td class="awrnc" align="right"/> <td class="awrnc" align="right"/> <td class="awrnc" align="right">27,737</td> <td class="awrnc" align="right"/> <td class="awrnc" align="right">46.58</td> </tr> <tr> <td class="awrc">Network</td> <td class="awrc" align="right">34,576,138</td> <td class="awrc" align="right"/> <td class="awrc" align="right">2,565</td> <td class="awrc" align="right">0</td> <td class="awrc" align="right">4.31</td> </tr> <tr> <td class="awrnc">System I/O</td> <td class="awrnc" align="right">6,850,776</td> <td class="awrnc" align="right"/> <td class="awrnc" align="right">636</td> <td class="awrnc" align="right">0</td> <td class="awrnc" align="right">1.07</td> </tr> <tr> <td class="awrc">Commit</td> <td class="awrc" align="right">413,851</td> <td class="awrc" align="right"/> <td class="awrc" align="right">472</td> <td class="awrc" align="right">1</td> <td class="awrc" align="right">0.79</td> </tr> <tr> <td class="awrnc">User I/O</td> <td class="awrnc" align="right">1,012,139</td> <td class="awrnc" align="right"/> <td class="awrnc" align="right">323</td> <td class="awrnc" align="right">0</td> <td class="awrnc" align="right">0.54</td> </tr> <tr> <td class="awrc">Other</td> <td class="awrc" align="right">13,976</td> <td class="awrc" align="right">1</td> <td class="awrc" align="right">53</td> <td class="awrc" align="right">4</td> <td class="awrc" align="right">0.09</td> </tr> <tr> <td class="awrnc">Concurrency</td> <td class="awrnc" align="right">55,797</td> <td class="awrnc" align="right"/> <td class="awrnc" align="right">13</td> <td class="awrnc" align="right">0</td> <td class="awrnc" align="right">0.02</td> </tr> <tr> <td class="awrc">Configuration</td> <td class="awrc" align="right">63</td> <td class="awrc" align="right">5</td> <td class="awrc" align="right">1</td> <td class="awrc" align="right">12</td> <td class="awrc" align="right">0.00</td> </tr> <tr> <td class="awrnc">Administrative</td> <td class="awrnc" align="right">4</td> <td class="awrnc" align="right"/> <td class="awrnc" align="right">0</td> <td class="awrnc" align="right">9</td> <td class="awrnc" align="right">0.00</td> </tr> </tbody> </table> So I would like to be able to provide an input of "Wait Class" and either - (if document order can be relied on) get an ordered set of "Application", "CPU time", "Network", "System I/O" , "Commit", "User I/O", "Other", "Concurrency", "Configuration", "Administrative" - Or supply an "index" value of 1 and get back "Application" and then supply an index of 2 and get back "CPU time" (I am assuming that I can rely on the first option across all implementations?). In case anyone is wondering - these are Oracle AWR reports which I am trying to parse, I have thousands of historical ones and need to build some trend analysis based on them. Cheers, Karl.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] debugging document() call, Robby Pelssers | Thread | Re: [xsl] Getting html table cell v, David Carlisle |
RE: [xsl] Unique Attribute value, pankaj . c | Date | Re: [xsl] Getting html table cell v, David Carlisle |
Month |