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