[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] How to calculate column number of the entry?


Subject: [xsl] How to calculate column number of the entry?
From: Toshihiko Makita <tmakita@xxxxxxxxx>
Date: Thu, 28 May 2009 12:03:38 +0900

Hi all,

I have a question about DocBook table to XSL-FO transformation.

I am developing DocBook table to XSL-FO stylesheet. It is not
specialized for specific user use. It should be a general stylesheet.

My question is as follows:

1. The table columns are described with colspec element like follows:

   <colspec colname="col1" colwidth="1*"/>
   <colspec colname="col2" colwidth="2*" align="right"/>
   <colspec colname="col3" colwidth="2*"/>

2. Usually XSL-FO property is inherited from fo:table-and-caption ==>
fo:table ==> fo:table-header, fo:table-footer, fo:table-body ==>
fo:table-row ==> fo:table-cell. However I want to apply colspec/@align
attribute using from-table-column() function to fo:table-cell *only*
when it is defined in colspec element. In the above example, I want to
apply text-align="right" to the fo:table-cell only when its column
number is 2.

   <fo:table-cell text-align="from-table-column()">
    ...
   </fo:table-cell)

3. To know colspec/@align is defined or not in colspec, it is necessary
to know what column number current entry is. The entry element defines
colname, namest or spanname attribute. If one of them is specified, the
stylesheet can calculate column number from the attribute value. But
these attributes are not mandatory.

4. If above attributes are not defined in the entry element, the
stylesheet must calculate the column number by itself. I think it is
easy when the table has no row spans. If there are row spans, it may be
impossible for stylesheet to calculate the correct column number.

Is there any elegant way to get the column number of the entry element
in stylesheet? Or is there any misunderstanding in my assumption?

Any suggestion is welcome.

Thanks,

Toshihiko Makita


Current Thread
Keywords