Charli: XSL, XML, Tabelle mit Colspan und Ausrichtung!

Beitrag lesen

Hallo!

Ich habe eine Tabelle mit Colspans und die Visualisierung erfolgt mit Hilfe von XSLT.
Es funktioniert alles außer die Ausrichtung z.B. zentriert, rechts, links (<td align="center"> ...). Ich stehe auf dem Schlau und brauche Hilfe damit die Ausrichtung funktioniert.

=======XML Datei========
<article>
  <title>test colspan</title>
  <table>
    <tgroup cols="4">
     <col width="40%"></col>
     <col width="20%"></col>
     <col width="20%"></col>
     <col width="20%"></col>
      <thead>
        <tr>
          <td align="right">spalte 1</td>
          <td align="center">spalte 2</td>
          <td colspan="2" align="left">spalte 3-4</td>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td align="center">spalte 1 zeile 2</td>
          <td align="left">spalte 2 zeile 2</td>
          <td align="right">spalte 3 zeile 2</td>
          <td align="center">spalte 4 zeile 2</td>
        </tr>
        <tr>
          <td align="center">spalte 1 zeile 3</td>
          <td colspan="2" align="center">spalte 2-3 zeile 3</td>
          <td align="center">spalte 4 zeile 3</td>
        </tr>
        <tr>
          <td colspan="3" align="center">spalte 1-3 zeile 4</td>
          <td align="right">spalte 4 zeile 4</td>
        </tr>
      </tbody>
    </tgroup>
  </table>
</article>

==========XSL Datei========
<xsl:template name="entry">
  <xsl:param name="gi" select="'td'" />
  <xsl:param name="curr" />
  <xsl:element name="{$gi}">
    <xsl:if test="@colspan>0">
      <xsl:attribute name="colspan">
        <xsl:value-of select="$curr/@colspan"/>
      </xsl:attribute>
    </xsl:if>
 <xsl:apply-templates select="$curr/node()"/>
  </xsl:element>
</xsl:template>

<xsl:template match="tbody/tr/td">
  <xsl:call-template name="entry">
    <xsl:with-param name="gi">td</xsl:with-param>
    <xsl:with-param name="curr" select="."/>
  </xsl:call-template>
</xsl:template>

<xsl:template match="thead/tr/td">
  <xsl:call-template name="entry">
    <xsl:with-param name="gi">td</xsl:with-param>
    <xsl:with-param name="curr" select="."/>
  </xsl:call-template>
</xsl:template>

<xsl:template match="td">
 xsl:choose
   <xsl:when test="@align='center'">
     <td><xsl:attribute name="align">center</xsl:attribute>xsl:apply-templates/</td>
   </xsl:when>
   <xsl:when test="@align='right'">
     <td><xsl:attribute name="align">right</xsl:attribute>xsl:apply-templates/</td>
   </xsl:when>
   <xsl:when test="align='left'">
     <td><xsl:attribute name="align">left</xsl:attribute>xsl:apply-templates/</td>
   </xsl:when>
   xsl:otherwise
     <td>xsl:apply-templates/</td>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

Vielen Dank!

Gruß,
Charli