You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Joona Palaste <jo...@dmm.fi> on 2004/02/09 22:51:55 UTC
Further XSLT question
Thanks to Agnes Kielen and Jarkko Moilanen, I've managed to write an
XSLT stylesheet that groups successive value nodes into group nodes.
But there's one thing I can't figure out.
I'm trying to implement a transform from a simple one-dimensional list
to a two-dimensional table in the XSL:FO language. The list (a simplified
version of our real source XML, which is secret) looks like this:
<list delimiter="," module="3">
<node>1</node>
<node>2</node>
<node>3</node>
<node>4</node>
<node>5</node>
<node>6</node>
</list>
The XSL I'm using (again, a simplified one) looks like this:
<xsl:template match="list">
<xsl:variable name="module"><xsl:value-of
select="@module"/></xsl:variable>
<fo:table table-layout="fixed">
<xsl:for-each select="node[position()<($module+1)]">
<fo:table-column column-width="20mm"/>
</xsl:for-each>
<fo:table-body>
<xsl:for-each select="node[(position() mod $module)=1]">
<fo:table-row>
<xsl:for-each select=". |
following-sibling::node[position()<$module]">
<fo:table-cell>
<fo:block>
<xsl:value-of select=".">
<!--
<xsl:if test="not(position()=last())">
<xsl:value-of select="../@delimiter"/>
</xsl:if>
-->
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:template>
This works fine, and produces a two-dimensional XSL:FO table. But if I
uncomment the block shown above in <!-- --> to make it real XSL code,
then the table only renders the first table-cell in every table-row.
What is the reason for this?
Joona Palaste
joona.palaste@dmm.fi