[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] from-table-column() and spans
Subject: [xsl] from-table-column() and spans From: "Murray McDonald" <m.mcdonald@xxxxxxxxx> Date: Mon, 28 Feb 2011 12:46:51 -0500 |
I am using RenderX. I am "simulating" a gutter following a data column by specifiying the "margin-right" property on the block or block-container in each table-cell. Ideally, I would like to pick this up from a table-column element using the "from-table-column()" function. Now the first problem is that although the shorthand "margin" property is allowed on a table-column "margin-right" is not allowed, however, "space-end" is allowed. The second problem is that the data is rife with horizontal spans and the "correct" space-end property to pick up for a spannned cell is the space-end value of the last column in the span. The spec says this about the "from-table-column" function and how it should deal with spans: "Function: object from-table-column( NCName) The from-table-column function returns the inherited value of the property whose name matches the argument specified, or if omitted for the property for which the expression is being evaluated, from the fo:table-column whose column-number matches the column for which this expression is evaluated and whose number-columns-spanned also matches any span. If there is no match for the number-columns-spanned, it is matched against a span of 1. If there is still no match, the initial value is returned. It is an error to use this function on formatting objects that are not an fo:table-cell or its descendants." I modified my XSLT to produce table-column definitions for individual columns as well as whatever spans are actually present in the data: <xsl:template match="colspec"> <xsl:variable name="thisColspec" select="."/> <fo:table-column> <xsl:attribute name="column-number" select="count(preceding-sibling::colspec)+1"/> <xsl:attribute name="column-width" select="concat(@colsize, 'pt')"/> <xsl:attribute name="text-align" select="@align"/> <xsl:attribute name="space-end" select="concat(@followingGutter, 'pt')"/> </fo:table-column> <!-- we need these for gutters following spanned columns picked up via "from-table-column" --> <!-- get a list of all columns this column spans "to" --> <xsl:variable name="spans" select="distinct-values(parent::tgroup/descendant::entry[@namest=$thisColspe c/@colname]/@nameend)"/> <!-- for each column "spanned to" generate a table-column with the number of columns spanned and the space-end value derived from the last column in the span --> <xsl:for-each select="$spans"> <xsl:variable name="endColName" select="."/> <fo:table-column> <xsl:variable name="endColNumber" select="1+count($thisColspec/parent::tgroup/colspec[@colname=$endColName]/pr eceding-sibling::colspec)"/> <xsl:variable name="startColNumber" select="count($thisColspec/preceding-sibling::colspec)+1"/> <xsl:attribute name="column-number" select="$startColNumber"/> <xsl:attribute name="number-columns-spanned" select="1 + $endColNumber - $startColNumber"/> <xsl:attribute name="column-width" select="concat($thisColspec/@colsize, 'pt')"/> <xsl:attribute name="text-align" select="$thisColspec/@align"/> <xsl:attribute name="space-end" select="concat($thisColspec/parent::tgroup/colspec[@colname=$endColName]//@f ollowingGutter, 'pt')"/> </fo:table-column> </xsl:for-each> </xsl:template> Producing a set of table-columns such as this: <fo:table table-layout="fixed" width="40pc"> <fo:table-column column-number="1" column-width="19pt" text-align="left" space-end="0pt"/> <fo:table-column column-number="1" number-columns-spanned="6" column-width="19pt" text-align="left" space-end="18pt"/> <fo:table-column column-number="2" column-width="17pt" text-align="left" space-end="0pt"/> <fo:table-column column-number="2" number-columns-spanned="5" column-width="17pt" text-align="left" space-end="18pt"/> <fo:table-column column-number="3" column-width="17pt" text-align="left" space-end="0pt"/> <fo:table-column column-number="3" number-columns-spanned="4" column-width="17pt" text-align="left" space-end="18pt"/> <fo:table-column column-number="4" column-width="17pt" text-align="left" space-end="0pt"/> <fo:table-column column-number="4" number-columns-spanned="3" column-width="17pt" text-align="left" space-end="18pt"/> <fo:table-column column-number="5" column-width="17pt" text-align="left" space-end="0pt"/> <fo:table-column column-number="5" number-columns-spanned="2" column-width="17pt" text-align="left" space-end="18pt"/> <fo:table-column column-number="6" column-width="279pt" text-align="left" space-end="18pt"/> <fo:table-column column-number="7" column-width="63pt" text-align="right" space-end="12pt"/> <fo:table-column column-number="7" number-columns-spanned="2" column-width="63pt" text-align="right" space-end="0pt"/> <fo:table-column column-number="8" column-width="51pt" text-align="right" space-end="0pt"/> <fo:table-body start-indent="0"> The problem is that using when I specify margin-right="from-table-column(space-end)" it seems to pick up the value from the FIRST table-column with column-number "n" and does not respect the "number-columns-spanned". (I manually re-oredered the <fo:table-column> elements and adjusted properties to determine behaviour.) Am I misinterpreting the spec or is this a "bug" in how Renderx has implemented "from-table-column()" or perhaps I am not doing something I need to do? Thanks!
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Selectively Applying use-, Tony Nassar | Thread | [xsl] Extracting a fragment between, Jeroen Hellingman |
RE: [xsl] Table columns - fixed spa, Murray McDonald | Date | [xsl] Extracting a fragment between, Jeroen Hellingman |
Month |
Keywords