[xsl] CALS and keys (difficult)

Subject: [xsl] CALS and keys (difficult)
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Feb 2002 17:32:14 -0000
Hi everybody,

In my continuing quest to get a stylesheet that displays cals tables, I have
come across a problem that hopefully someone will take on.

This is using Wendell's version of Norman Walsh's code.

This code seems to cover most things, but doesnt manage colspans (as far as
I can tell) where they are specified using @spanname.

So, I need this psuedocode converted to xsl (I think using keys):

match <entry>
if it has attribute spanname
  find ancestor <spanspec> with same spanname attribute
    get namest attribute
    get nameend attribute
  work out number of columns from colspec, based on colname attributes
  output 'colspan=' the value


===The XML snippet===
<tgroup cols="4">
  <colspec colname="C.9P2" colnum="1" colwidth="55mm"/>
  <colspec colname="C.9PC" colnum="2" colwidth="32mm" align="CENTER"/>
  <colspec colname="C.9PE" colnum="3" colwidth="32mm" align="CENTER"/>
  <colspec colname="C.9PG" colnum="4" colwidth="49mm"/>
  <spanspec spanname="S.9PA" namest="C.9PB" nameend="C.9PD"/>
  <thead valign="MIDDLE">
     <colspec colname="C.9PH" colnum="1" colwidth="55mm"/>
     <colspec colname="C.9PB" colnum="2" colwidth="32mm" align="CENTER"/>
     <colspec colname="C.9PD" colnum="3" colwidth="32mm" align="CENTER"/>
     <colspec colname="C.9PF" colnum="4" colwidth="49mm"/>
     <row rowsep="1">
        <entry colname="C.9PH" morerows="1" valign="MIDDLE"
align="CENTER">Item</entry>
        <entry spanname="S.9PA" rowsep="1" align="CENTER">Location</entry>
        <entry colname="C.9PF" morerows="1" valign="MIDDLE"
align="CENTER">Access</entry>
     </row>
     <row rowsep="1">
        <entry colname="C.9PB" align="CENTER">Zone</entry>
        <entry colname="C.9PD" align="CENTER">Compartment</entry>
     </row>
  </thead>

===The Required HTML===
<tr>
  <th rowspan="2" align="CENTER" valign="MIDDLE">Item</th>
  <th colspan="2" align="CENTER">Location</th>
<th rowspan="2" align="CENTER" valign="MIDDLE">Access</th>
</tr>
<tr>
  <th align="CENTER">Zone</th>
  <th align="CENTER">Compartment</th>
</tr>


**The current implementation does everything except insert the 'colspan="2"'
because it doesnt match @spanname on <entry>**

Many thanks to anyone taking this on

cheers

andrew

===


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread