You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Julien Vinel <ju...@thales-is.com> on 2003/08/05 13:44:01 UTC

How to use a variable for an attribut specification

Hello,

I would like to do a "col-span" who depend on the value of a variable,
for example :

I have an xml file which contains:
<header>
  <item>Header 1</item>
  <item>Header 2</item>
  <item>Header 3</item>
</header>

And an xsl code like this :

<xsl:variable name="nb_header" select="count(header/item)"/>

<fo:table>
  <fo:table-column column-width="4cm"/>
  <xsl:for-each select="header/item">
    <fo:table-column column-width="4cm"/>
  </xsl:for-each>
  <fo:table-column column-width="3cm"/>
  <fo:table-body>
    <fo:table-header>
      <fo:table-row>
        <fo:table-cell>
          <fo:block>Test 1</fo:block>
        </fo:table-cell>
        <fo:table-cell number-columns-spanned="$nb_header">
          <fo:block>General comment for header 1, 2, 3</fo:block>
        </fo:table-cell>
        <fo:table-cell>
          <fo:block>Test 2</fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-header>
   <!-- Data here -->
  </fo:table-body>
</fo:table>

Fop give me an error :
[ERROR] Error in number-columns-spanned property value '$nb_header':
org.apache.fop.fo.expr.PropertyException: illegal character

Is it possible to do that ?

Thanks,

Julien

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org