This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error in column-width property value '33%'


Hi Simon,

the error message occurs because fop doesn't implement tables the way norm's
stylesheets (and the fo spec AFAIK) expect.
A workaround is to transform these %-values with absolute values. I use a
variant of the fo-patch-for-fop.xsl stylesheet that norm provides. I've included
it, but it is probably not the best sample of xsl you'll ever see :-). For
example I have hardcoded the values for the table width and the unit. So you
probably need to adapt it to your needs. Simply transform your source to fo,
then apply this stylesheet to the resulting fo file and  transform that file to
pdf with fop.

I have not yet tried to find a workaround for the other type of error message
[ERROR] Unknown enumerated value for property 'relative-align': baseline
[ERROR] Error in relative-align property value 'baseline':
org.apache.fop.fo.expr.PropertyException: No conversion defined
 Maybe it can be treated the same way. I don't expect that norm fixes this as it
is not a problom of his stylesheet but a insufficient implementation of the fo
spec.

Hope this helps
Martin

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:fo="http://www.w3.org/1999/XSL/Format";
                xmlns:fox="http://xml.apache.org/fop/extensions";
                version="1.0">
 <!-- $Id: table-patch-for-fop.xsl,v 1.2 2002/06/14 19:39:46 Martin Exp $ -->
<xsl:output method="xml" indent="yes"/>

<xsl:template match="*">
  <xsl:element name="{name(.)}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<xsl:template match="fo:table-column">
  <xsl:variable name="string" select="@column-width"/>
  <xsl:variable name="percent-value">
    <xsl:value-of select="substring-before($string, $percent)"/>
  </xsl:variable>
  <xsl:variable name="fraction">
    <xsl:value-of select="$percent-value div 100"/>
  </xsl:variable>

  <xsl:element name="{name(.)}">
    <xsl:choose>
      <xsl:when test="contains($string,$percent)">
        <xsl:attribute name="column-width">
          <xsl:value-of select="$table-width * $fraction"/>
          <xsl:text>cm</xsl:text>
        </xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="column-width">
          <xsl:value-of select="$string"/>
        </xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:attribute name="column-number">
      <xsl:value-of select="@column-number"/>
    </xsl:attribute>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<xsl:param name="percent">%</xsl:param>
<xsl:param name="table-width">15</xsl:param>
</xsl:stylesheet>




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]