xsl-list
[Top] [All Lists]

Converting from Excel 2003 to a table XSLT 1.0 (saxon 6.5)

2005-07-26 01:43:26
hello,

I am converting an Excel 2003 Table element to an html table element.

Conversion goes OK if all elements have content or even if one set of elements 
are empty but if more than one set of elements are empty then I get it wrong. 
Can anybody give me good advice on this:

This is how teh Table Row looks like in Excel. First Cell element begins at 
column 3 and the 4th Cell element begins at column 7. 
----------------------------
<Row> 
<Cell ss:Index="3" ss:StyleID="s25"> 
<Data ss:Type="String">L1</Data> 
</Cell> 
<Cell> 
<Data ss:Type="String">Åland</Data> 
</Cell> 
<Cell> 
<Data ss:Type="String">se</Data> 
</Cell> 
<Cell ss:Index="7"> 
<Data ss:Type="String">Ahvenanmaa</Data> 
</Cell> 
</Row>
------------------------------

This is what I have made sofar: It adds correct amount of empty cells for 1st 
Cell but I have not figured out how to calculate on what <td> element I am the 
next time. 


<xsl:template match="ss:Cell">
<xsl:if test="@ss:Index &gt; position()">
<xsl:call-template name="produce-empty-cells">
<xsl:with-param name="count" select="@ss:Index - position()"/>
</xsl:call-template>
</xsl:if>
<td>
<xsl:value-of select="ss:Data"/>
</td>
</xsl:template>

<xsl:template name="produce-empty-cells">
<xsl:param name="count"/>
<xsl:if test="$count != 0">
<td></td>
<xsl:call-template name="produce-empty-cells">
<xsl:with-param name="count" select="$count - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

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

regards
Kaarle Kaila

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>