Re: Table in an xml doc.

by "Garreth Galligan" <garreth.galligan(at)oceanfree.net>

 Date:  Mon, 19 Mar 2001 23:36:26 -0000
 To:  <hwg-xml(at)hwg.org>
 References:  deere
  todo: View Thread, Original
This example is using valid markup according to the DTD:

<table>
<row><cell>Ships.</cell><cell>Guns.</cell><cell>Cost of
one.</cell><cell>Cost of all</cell></row>
<row><cell>6</cell><cell>100</cell><cell>35,553</cell><cell>213,318</cell></
row>
<row><cell>12</cell><cell>90</cell><cell>29,886</cell><cell>358,632</cell></
row>
<row><cell>12</cell><cell>80</cell><cell>23,638</cell><cell>283,656</cell></
row>
<row><cell>43</cell><cell>70</cell><cell>17,785</cell><cell>764,755</cell></
row>
<row><cell>35</cell><cell>60
</cell><cell>14,197</cell><cell>96,895</cell></row>
<row><cell>40</cell><cell>50</cell><cell>10,606</cell><cell>424,240</cell></
row>
<row><cell>45</cell><cell>40</cell><cell>7,558</cell><cell>-340,110</cell></
row>
<row><cell>58</cell><cell>20</cell><cell>3,710</cell><cell>215,180</cell></r
ow>
</table>

However the linked CSS file contains no instructions on how to render these
elements. The CSS2 table properties would be the way to go for displaying a
table, but wide support isn't there for them yet. Adding the following style
declarations to robin1cs.css would provide a table like appearance (under
MSIE 5.0/Gecko anyway) to the example above, but it is a total hack:

---------------------------------------
/*
Very quick and dirty fixed coulmn width table structure.
*/

table {
 display: block;
 width: 100%;
}

cell {
 display: block;
  float: left;
  /*
  the width attribute is essentially the nasty hack
  to generate column like behavior
  cell must be block in Gecko for width to be rendered
  hence the float/clear attributes - block spoofing inline
   */
  width:20%;
}

row {
  display: block;
  clear: both;
  width: 100%;
}

---------------------------------------------------------

IMHO the way to go would be to use XSLT to transform straight to HTML.
Examining the DTD it would seem the bulk of the element types have directly
corresponding HTML element types and so the XSLT should not be too difficult
to produce.

Hope that helps
    Garreth




From: "Devlin Peter W" <DevlinPeterW(at)JohnDeere.com>
To: "'Mark Flint'" <mflint(at)ce.mediaone.net>; <hwg-xml(at)hwg.org>
Sent: Friday, March 16, 2001 11:53 PM
Subject: RE: It is getting too quiet in here again. Does anyone have anyq
uestions?/Table in an xml doc.

> Hello,
>
> Because I'm fairly new to xml markup I haven't experienced marking up a
> table (properly) yet. I've looked at the dtd's for tags but have thus far
> failed to get a table. This is what I've done so far:
>
> <para>
> <table>
> <row>
> <cell>[pounds Sterling]</cell><cell>For a ship of a 100
> guns</cell><cell>35,553</cell></row>
> <row><cell></cell><cell>90</cell><cell>29,886</cell></row>
> <row><cell></cell><cell>80</cell><cell>23,638</cell></row>
> <row><cell></cell><cell>70</cell><cell>17,795</cell></row>
> <row><cell></cell><cell>60</cell><cell>14,197</cell></row>
> <row><cell></cell><cell>0</cell><cell>10,606</cell></row>
> <row><cell></cell><cell>40</cell><cell>7,558</cell></row>
> <row><cell></cell><cell>0</cell><cell>5,846</cell></row>
> <row><cell></cell><cell>20</cell><cell>3,710</cell></row>
> </table>
> </para>
>
> ########This is another table in the book that I tried 'blockquote' or use
> 'pre'
>  on with no avail:
>
> <blockquote>
>     Ships.      Guns.     Cost of one.        Cost of all
>        6     -   100   -    35,553    -         213,318
>       12     -    90   -    29,886    -         358,632
>       12     -    80   -    23,638    -         283,656
>       43     -    70   -    17,785    -         764,755
>       35     -    60   -    14,197    -         496,895
>       40     -    50   -    10,606    -         424,240
>       45     -    40   -     7,558    -         340,110
>       58     -    20   -     3,710    -         215,180
>
>       85 Sloops, bombs,
>       and fireships, one     2,000              170,000
>       with another,                           _________
>                                         Cost  3,266,786
>       Remains for guns,    _________            233,214
>                                               _________
>                                               3,500,000
> </blockquote>
> </para>
>
> The etext I'm working on can be seen at
> http://www.angelfire.com/il/journaljourney/projectgutenberg/comsn10.xml.
The
> tables are abouat 2/3's through the book.
>
> Thank you for your help.
>
> Pete Devlin

HWG hwg-xml mailing list archives, maintained by Webmasters