[xsl] Convert CALS Table

Subject: [xsl] Convert CALS Table
From: gregor FELLENZ <gf_public@xxxxxxx>
Date: Fri, 18 Feb 2005 20:10:13 +0100
hello xsl-list,

i have to normalize CALS tables, to another table model which has no
colspan resp. rowspan abilities.

I have to fill for each omitted entry an empty cell in my new
document, to generate valid tables.

Realizing this for colspan is no problem (as you can see in my
xslt) but i have no idea how to cover the rowspan.
The problem is, that i have to insert in every spanned row an empty
cell, but how can i gather this information?

Any ideas or hints how i can realize this?



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output indent="yes" method="xml"/>
<xsl:template match="table">

<xsl:template match="row">
                <xsl:for-each select="entry">
                                <xsl:when test="@namest != '' ">
                                        <xsl:variable name="temp" select="@nameend"/>
                                        <xsl:variable name="ende" select="ancestor::*/colspec[@colname = $temp]/@colnum"/>
                                        <xsl:call-template name="zellenschreiben">
                                                <xsl:with-param name="anzahl" select="1"/>
                                                <xsl:with-param name="ende" select="$ende -position()"/>

<xsl:template name="zellenschreiben">
        <xsl:param name="anzahl"/>
        <xsl:param name="ende"/>
        <xsl:if test="$anzahl &lt;= $ende">
                <xsl:call-template name="zellenschreiben">
                        <xsl:with-param name="anzahl" select="$anzahl + 1"/>
                        <xsl:with-param name="ende" select="$ende"/>

*** Source Example, its CALS
        <tgroup cols="4">
                <colspec colnum="1" colname="spycolgen1" colwidth="1.0*"/>
                <colspec colnum="2" colname="spycolgen2" colwidth="1.0*"/>
                <colspec colnum="3" colname="spycolgen3" colwidth="1.0*"/>
                <colspec colnum="4" colname="spycolgen4" colwidth="1.0*"/>
                                <entry namest="spycolgen1" nameend="spycolgen3">colspan</entry>
                                <entry morerows="1">rowspan</entry>

*** Result ...
                <cell/><!-- This empty cell comes from the colspan ... -->
                <!-- Here I need another <cell/> to get valid code -->

enforce privacy - http://www.pgpi.org
pgp key id: 0x7DBB8BA1 - http://pgp.mit.edu

Freitag, 18. Februar 2005 19:20

Current Thread