[Home] [By Thread] [By Date] [Recent Entries]
Hello Gustaf,
here is a solution that works for me: <xsl:template match="tr">
<xsl:apply-templates select="td|th"/>
</xsl:template><xsl:template match="td|th">
<xsl:variable name="x" select="position()"/>
<fo:table-cell>
<xsl:copy-of select="(ancestor::table/colgroup/col)[$x]/@width"/>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>The correct applying the template on td and th is important for a correct position(). The next step is the "grouping" of the col-elements. Because they have different colgroup-parents, you must use parentheses for this job. This should work. Two more comments: Why are you using the attribute-axis, writing @ is much shorter ... and in my eyes more readable. And have a look at <xsl:copy-of/> above. It does the same job like your <xsl:if/> + <xsl:attribute/> + <xsl:value-of/>. If a attribute should have the same name and value in input and output, it will be easier to copy it. Output: <fo:table-cell width="30%" xmlns:fo="test"> <fo:block>A header</fo:block> </fo:table-cell> <fo:table-cell width="60%" xmlns:fo="test"> <fo:block>Some content here.</fo:block> </fo:table-cell> <fo:table-cell width="10%" xmlns:fo="test"> <fo:block>Some more here.</fo:block> </fo:table-cell> Regards, Joerg Gustaf Liljegren wrote: Mike Brown wrote: XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



