[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

converting empty nodes to col/rowspan values

Subject: converting empty nodes to col/rowspan values
From: "Reece, Michael Clark" <REECEM@xxxxxxxxxxxx>
Date: Tue, 13 Apr 2004 16:39:55 -0400
michael reece
I am try to format an html with colspan and rowspan values for empty nodes.
For example with:
 
<?xml version="1.0"?>
<table>
  <row>
    <cell>Sample Table</cell>
    <cell></cell>
    <cell></cell>
    <cell></cell>
    <cell></cell>
  </row>
  <row>
    <cell>A</cell>
    <cell>B</cell>
    <cell></cell>
    <cell>C</cell>
    <cell></cell>
  </row>
  <row>
    <cell></cell>
    <cell>D</cell>
    <cell>E</cell>
    <cell>F</cell>
    <cell>G</cell>
  </row>
  <row>
    <cell>H</cell>
    <cell>I</cell>
    <cell>J</cell>
    <cell>K</cell>
    <cell></cell>
  </row>
</table>
 
I want the first row to be:
  <tr><td colspan=5>Sample Table</td></tr>
And the second row to be:
  <tr><td rowspan=2>A</td><td colspan=2>B</td><td colspan=2>C</td></tr>
 
And so forth...
 
This is my template:
 
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform
<http://www.w3.org/1999/XSL/Transform> ">
<xsl:template match="/">
      <html>
      <table border="1">
      <xsl:apply-templates/>
      </table>
      </html>
</xsl:template>
<xsl:template match="table">
      <xsl:for-each select="row">
            <tr><xsl:apply-templates/></tr>
      </xsl:for-each>
</xsl:template>
<xsl:template match="cell">
      <td><xsl:value-of select="."/></td>
</xsl:template>
</xsl:stylesheet>
 
I have tried many iterations but cannot figure this out.  Thanks...
 
Michael Reece

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.