Re: Broken tables

Subject: Re: Broken tables
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Jun 2000 13:47:31 +0100 (BST)
> I have an SGML document I'm converting to xml,
> and I'm having trouble with the tables :-)

alternatively you can modify your SGML DTD so that
the SGML parser explictly places table entries inside an element
by having the dtd have a cell entry (foo below) whose presence is
forced by the DTD but whose start and end tags are always omitted.
(SGML can be so much more opaque than XML; much more fun to be had:-)

So given

<!DOCTYPE TABLE [

<!ELEMENT TABLE - - (TABULAR)>
<!ELEMENT TABULAR - - (TABROW)*>
<!-- <!ELEMENT TABROW - - (#PCDATA|TT|COLSEP)*> -->
<!ELEMENT TT - - (#PCDATA)>
<!ELEMENT COLSEP -O EMPTY>
<!ENTITY amp CDATA "&#38;">

<!ELEMENT TABROW - - (foo,(COLSEP,foo)*)>
<!ELEMENT foo O O (#PCDATA|TT)*> 
]>
<TABLE>
<TABULAR>
<TABROW>Driver Name<COLSEP>a</TABROW>
<TABROW><TT>apm</TT><COLSEP>Alliance Pro Motion</TABROW>
<TABROW><TT>ati</TT><COLSEP>ATI</TABROW>
<TABROW><TT>chips</TT><COLSEP>Chips &amp; Technologies</TABROW>
<TABROW><TT>cirrus</TT><COLSEP>Cirrus Logic</TABROW>
<TABROW><TT>cyrix</TT> (*)<COLSEP>Cyrix MediaGX</TABROW>
<TABROW><TT>fbdev</TT><COLSEP>Linux fbdev</TABROW>
<TABROW><TT>glide</TT><COLSEP>Glide2x (3Dfx)</TABROW>
<TABROW><TT>glint</TT><COLSEP>3Dlabs, TI</TABROW>
<TABROW><TT>i740</TT><COLSEP>Intel i740</TABROW>
<TABROW><TT>i810</TT><COLSEP>Intel i810</TABROW>
<TABROW><TT>mga</TT><COLSEP>Matrox</TABROW>
<TABROW><TT>neomagic</TT><COLSEP>NeoMagic</TABROW>
<TABROW><TT>nv</TT><COLSEP>NVIDIA</TABROW>
<TABROW><TT>r128</TT><COLSEP>ATI Rage 128</TABROW>
<TABROW><TT>rendition</TT><COLSEP>Rendition</TABROW>
<TABROW><TT>s3virge</TT><COLSEP>S3 ViRGE</TABROW>
<TABROW><TT>sis</TT><COLSEP>SiS</TABROW>
<TABROW><TT>tdfx</TT><COLSEP>3Dfx</TABROW>
<TABROW><TT>tga</TT><COLSEP>DEC TGA</TABROW>
<TABROW><TT>trident</TT><COLSEP>Trident</TABROW>
<TABROW><TT>tseng</TT><COLSEP>Tseng Labs</TABROW>
<TABROW><TT>vga</TT><COLSEP>Generic VGA</TABROW>
</TABULAR>
</TABLE>


(o)sx produces:

<?xml version="1.0"?>
<TABLE
><TABULAR
><TABROW
><FOO
>Driver Name</FOO><COLSEP
></COLSEP><FOO
>a</FOO></TABROW><TABROW
><FOO
><TT
>apm</TT></FOO><COLSEP
></COLSEP><FOO
>Alliance Pro Motion</FOO></TABROW><TABROW
><FOO
><TT
>ati</TT></FOO><COLSEP
></COLSEP><FOO
>ATI</FOO></TABROW><TABROW
><FOO
><TT
>chips</TT></FOO><COLSEP
></COLSEP><FOO
>Chips &amp; Technologies</FOO></TABROW><TABROW
><FOO
><TT
>cirrus</TT></FOO><COLSEP
></COLSEP><FOO
>Cirrus Logic</FOO></TABROW><TABROW
><FOO
><TT
>cyrix</TT> (*)</FOO><COLSEP
></COLSEP><FOO
>Cyrix MediaGX</FOO></TABROW><TABROW
><FOO
><TT
>fbdev</TT></FOO><COLSEP
></COLSEP><FOO
>Linux fbdev</FOO></TABROW><TABROW
><FOO
><TT
>glide</TT></FOO><COLSEP
></COLSEP><FOO
>Glide2x (3Dfx)</FOO></TABROW><TABROW
><FOO
><TT
>glint</TT></FOO><COLSEP
></COLSEP><FOO
>3Dlabs, TI</FOO></TABROW><TABROW
><FOO
><TT
>i740</TT></FOO><COLSEP
></COLSEP><FOO
>Intel i740</FOO></TABROW><TABROW
><FOO
><TT
>i810</TT></FOO><COLSEP
></COLSEP><FOO
>Intel i810</FOO></TABROW><TABROW
><FOO
><TT
>mga</TT></FOO><COLSEP
></COLSEP><FOO
>Matrox</FOO></TABROW><TABROW
><FOO
><TT
>neomagic</TT></FOO><COLSEP
></COLSEP><FOO
>NeoMagic</FOO></TABROW><TABROW
><FOO
><TT
>nv</TT></FOO><COLSEP
></COLSEP><FOO
>NVIDIA</FOO></TABROW><TABROW
><FOO
><TT
>r128</TT></FOO><COLSEP
></COLSEP><FOO
>ATI Rage 128</FOO></TABROW><TABROW
><FOO
><TT
>rendition</TT></FOO><COLSEP
></COLSEP><FOO
>Rendition</FOO></TABROW><TABROW
><FOO
><TT
>s3virge</TT></FOO><COLSEP
></COLSEP><FOO
>S3 ViRGE</FOO></TABROW><TABROW
><FOO
><TT
>sis</TT></FOO><COLSEP
></COLSEP><FOO
>SiS</FOO></TABROW><TABROW
><FOO
><TT
>tdfx</TT></FOO><COLSEP
></COLSEP><FOO
>3Dfx</FOO></TABROW><TABROW
><FOO
><TT
>tga</TT></FOO><COLSEP
></COLSEP><FOO
>DEC TGA</FOO></TABROW><TABROW
><FOO
><TT
>trident</TT></FOO><COLSEP
></COLSEP><FOO
>Trident</FOO></TABROW><TABROW
><FOO
><TT
>tseng</TT></FOO><COLSEP
></COLSEP><FOO
>Tseng Labs</FOO></TABROW><TABROW
><FOO
><TT
>vga</TT></FOO><COLSEP
></COLSEP><FOO
>Generic VGA</FOO></TABROW></TABULAR></TABLE>

now it is a simple matter to have an xsl sheet turn FOO into entry
and discard COLSEP.


David


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


Current Thread