Subject: [xsl] How to properly use Key elements From: "G. T. Stresen-Reuter" <tedmasterweb@xxxxxxxxx> Date: Mon, 14 Oct 2013 01:41:18 +0100 |
Hi, I've read (and reread) Jeni Tenison's description of Muenchian Grouping several times and when my example is similar in structure to her example, I'm able to use it quite effectively but when my source XML varies from her example, I'm a bit lost. I'm wondering if I can create a key to group on ShipName and/or RouteNum. As a complication, I don't knowing anything more than the fact that ShipName is a preceding sibling and that there will be 4 TD elements in rows that contain ShipName. XML <table> <tbody> <tr> <td rowspan="6">ShipName</td> <td rowspan="3">RouteNum</td> <td>PortName</td> <td>PortCode</td> </tr> <tr> <td>PortName</td> <td>PortCode</td> </tr> <tr> <td>PortName</td> <td>PortCode</td> </tr> <tr> <td rowspan="3">RouteNum</td> <td>PortName</td> <td>PortCode</td> </tr> <tr> <td>PortName</td> <td>PortCode</td> </tr> <tr> <td>PortName</td> <td>PortCode</td> </tr> { repeat rows } </tbody> </table> My question is if I can "legally" define a KEY element like this: <xsl:key name="ports-by-ship" match="td[position() = (count(.) - 1)]" use="tr[count(td) = 4]/td[position() = 1]" /> The XSL spec says that "match" should be a "pattern" while "use" can be an "expression". I'm not exactly sure what they mean by expression, how it is different from a pattern match that uses a predicate. I've been unable to get this to work but it sure would be handy if I could. Thanks to anyone who can lend a hand. I've been off the list for years but recently found myself (happily) doing some more xslt. Sincerely, Ted Stresen-Reuter
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL-FO: keep-together.wit, Mario Madunic | Thread | Re: [xsl] How to properly use Key e, Wendell Piez |
RE: [xsl] XSL-FO: keep-together.wit, Tony Graham | Date | Re: [xsl] XSL-FO to PDF conversion , Jesper Tverskov |
Month |