RE: How do I do a table in XSL

Subject: RE: How do I do a table in XSL
From: lbolen@xxxxxxxxxxxxxxxxxxxxxxxxxx (Lori Bolen)
Date: Tue, 20 Apr 1999 11:42:52 -0500
Thanks Kevin.  Sometimes I seem to hit a wall and it takes an
example to get me back on track.

I can not change my tags.  For those of you who did not know or
recognize it, the table was actually from a model called the CALS
table model.  I do alot of work with IETMs and they use this table
model.  So I don't have much choice.  I have most of it displaying.
I didn't say is was right.  I just said it displayed.  One thing I need
to work on is spanning columns.  The spanpecs define my spans.
Then the entry elements reference these spans through an attribute.

How did I save the spanspec info so that I can recall the info in the
entry tag when I need it? 

Then there is spanning rows, but I will not get in to that right now.  
One problem at a time.  The solution would be similiar.  I need a 
way of saving info to reference later.

I have attached two files:  calstbl.xml and calstbl.xsl
  

This is an example of a CALS table and the xsl file I have working so
far.  I have commented the entry and spanspec rules.  This is where
my changes need to be.  At least I think that is where they need to go.
I figure I will have to do some type of scripting, but not sure on how
to get started.  Any help would be appreciated.  

As XML and XSL continue to develop, displaying this particular table
model will become an issue.  So please help me solve this problem
early in the game.  I have attached my xsl file for those how will also
run into this problem in the near future.

Thanks again for all your help Kevin.  It was greatly appreciated.

Lori Bolen

-----Original Message-----
From:	Kevin.Hooke@xxxxxxxx [SMTP:Kevin.Hooke@xxxxxxxx]
Sent:	Friday, April 16, 1999 3:24 PM
To:	xsl-list@xxxxxxxxxxxxxxxx
Subject:	Re: How do I do a table in XSL

>>From: lbolen@xxxxxxxxxxxxxxxxxxxxxxxxxx (Lori Bolen)
>>Date: Thu, 15 Apr 1999 11:21:45 -0500
>>
>>How do I display the following table using XSL?  I am using
>>Internet Explorer 5.0.  So far I have figured out how to
>>display everything except the following table.

Lori - I'm not sure what you are referring to here as you seem to have a
mix of your own XML tags and some HTML tags, so if you are putting this
straight into IE5 it will just ignore the tags it does not recognize.

If you restructure your XML something like this:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test table.xsl"?>

<tabledata>
<thead>
<entry>Col1 header</entry>
<entry>Col2 header</entry>
<entry>Col3 header</entry>
</thead>
<tbody>
<row>
<entry>Col 1</entry>
<entry>Col 2</entry>
<entry>Col 3</entry>
</row>
<row>
<entry span="3">Row 2 spans all columns.</entry>
</row>
</tbody>
</tabledata>

Then you could use a stylesheet something similar to this to get some valid
HTML output to display the data as an HTML table (I'm not saying this is
the best way and I may have over complicated things here, but it should
point you in the right direction):
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>

<xsl:template><xsl:apply-templates/></xsl:template>

<xsl:template match="/">
     <HTML>
          <p><b>HTML Table</b></p>
          <xsl:apply-templates select="tabledata"/>
     </HTML>
</xsl:template>

<xsl:template match="tabledata">
     <table>
     <xsl:apply-templates select="./thead"/>
     <xsl:apply-templates select="./tbody"/>
     </table>
</xsl:template>

<xsl:template match="thead">
     <thead>
     <xsl:apply-templates select="./entry" mode="thead"/>
     </thead>
</xsl:template>

<xsl:template match="entry" mode="thead">
     <th><xsl:value-of select="."/></th>
</xsl:template>

<xsl:template match="tbody">
     <tbody>
     <xsl:apply-templates select="./row"/>
     </tbody>
</xsl:template>

<xsl:template match="row">
     <tr><xsl:apply-templates select="entry" mode="tbody"/></tr>
</xsl:template>

<xsl:template match="entry" mode="tbody">
     <td><xsl:value-of select="."/></td>
</xsl:template>



</xsl:stylesheet>

Hope this helps,
Keivn Hooke



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

<<application/ms-tnef>>

Current Thread