[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

from-table-column() and spans

Subject: from-table-column() and spans
From: "Murray McDonald" <m.mcdonald@xxxxxxxxx>
Date: Mon, 28 Feb 2011 12:46:51 -0500
 from-table-column() and spans
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

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="."/>
		<xsl:attribute name="column-number"
		<xsl:attribute name="column-width" select="concat(@colsize,
		<xsl:attribute name="text-align" select="@align"/>
		<xsl:attribute name="space-end"
select="concat(@followingGutter, 'pt')"/>
	<!--	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"
      <!-- 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="."/>
			<xsl:variable name="endColNumber"
			<xsl:variable name="startColNumber"
			<xsl:attribute name="column-number"
			<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"
			<xsl:attribute name="space-end"
ollowingGutter, 'pt')"/>

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"
  <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"
  <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"
  <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"
  <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"
  <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"
  <fo:table-column column-number="7" column-width="63pt" text-align="right"
  <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"
  <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?


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.