Como generar una tabla con esta plantilla XSL
Publicado por emilio (1 intervención) el 17/06/2010 14:02:37
pues eso tengo que generar un xml para que con ayuda de una plantilla xsl genere un pdf. el problema es que en la plantilla se define el uso de tablas pero no se como usarla bien por que siempre me da error el codigo del xsl que define la tabla es este:
<!-- TABLA DE DATOS -->
<xsl:template match="table">
<fo:table xsl:use-attribute-sets="table">
<xsl:call-template name="process-common-attributes"/>
<xsl:apply-templates select="tcol"/>
<fo:table-body xsl:use-attribute-sets="tbody">
<xsl:apply-templates select="tr"/>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="tcol">
<fo:table-column>
<xsl:attribute name="column-width"><xsl:value-of select="@width"/></xsl:attribute>
</fo:table-column>
</xsl:template>
<xsl:template match="tr">
<fo:table-row xsl:use-attribute-sets="tr">
<xsl:call-template name="process-common-attributes-and-children"/>
</fo:table-row>
</xsl:template>
<xsl:template match="th">
<fo:table-cell xsl:use-attribute-sets="th">
<xsl:call-template name="process-table-cell"/>
</fo:table-cell>
</xsl:template>
<xsl:template match="td">
<fo:table-cell xsl:use-attribute-sets="td">
<xsl:call-template name="process-table-cell"/>
</fo:table-cell>
</xsl:template>
<xsl:template name="process-table-cell">
<xsl:if test="@colspan">
<xsl:attribute name="number-columns-spanned">
<xsl:value-of select="@colspan"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@rowspan">
<xsl:attribute name="number-rows-spanned">
<xsl:value-of select="@rowspan"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="process-common-attributes"/>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!----FIN --->
dentro del xml meto este codigo pedo da error:
<table>
<tbody>
<tr>
<th>
<td>hola mundo<td>
<th>
</tr>
</tbody>
</table>
como genero una tabla en xml segun la definicion del xsl?? muchas gracias
<!-- TABLA DE DATOS -->
<xsl:template match="table">
<fo:table xsl:use-attribute-sets="table">
<xsl:call-template name="process-common-attributes"/>
<xsl:apply-templates select="tcol"/>
<fo:table-body xsl:use-attribute-sets="tbody">
<xsl:apply-templates select="tr"/>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="tcol">
<fo:table-column>
<xsl:attribute name="column-width"><xsl:value-of select="@width"/></xsl:attribute>
</fo:table-column>
</xsl:template>
<xsl:template match="tr">
<fo:table-row xsl:use-attribute-sets="tr">
<xsl:call-template name="process-common-attributes-and-children"/>
</fo:table-row>
</xsl:template>
<xsl:template match="th">
<fo:table-cell xsl:use-attribute-sets="th">
<xsl:call-template name="process-table-cell"/>
</fo:table-cell>
</xsl:template>
<xsl:template match="td">
<fo:table-cell xsl:use-attribute-sets="td">
<xsl:call-template name="process-table-cell"/>
</fo:table-cell>
</xsl:template>
<xsl:template name="process-table-cell">
<xsl:if test="@colspan">
<xsl:attribute name="number-columns-spanned">
<xsl:value-of select="@colspan"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@rowspan">
<xsl:attribute name="number-rows-spanned">
<xsl:value-of select="@rowspan"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="process-common-attributes"/>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!----FIN --->
dentro del xml meto este codigo pedo da error:
<table>
<tbody>
<tr>
<th>
<td>hola mundo<td>
<th>
</tr>
</tbody>
</table>
como genero una tabla en xml segun la definicion del xsl?? muchas gracias
Valora esta pregunta


0