OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: DOCBOOK-APPS: Re: several messages


On Thu, 14 Feb 2002, Hugues Pichereau wrote:
> And another tip for tables in PDF with FOP 0.20.3 : "table-and-caption" and
> "caption" elements in FO (comming from XML tables titles) are not supported
> by FOP, so no tables can output in PDF.
> So to correct this, in the ebnf.xsl and formal.xsl comment the
> "table-and-caption" and "caption" elements, but not the "table" element
> inside. Then enjoy nice tables in PDF. Enclosed are the corrected
> stylesheets.
<snip/>

On Sun, 17 Feb 2002, Bob Stayton wrote:
> On Sat, Feb 16, 2002 at 03:12:23AM -0500, Stephen wrote:
> >
> > I'm using docbook v4.12 and the v1.48 docbook xsl stylesheets.  I'm processing the fo output through Fop-0.20.3rc and I don't seem to need the extra step of fo-patch-for-fop.xsl.  Most everything seems to work.
> >
> > However the table I made shows up in html but not in the
> > pdf.  The table does show up in the "List of Tables"
> > however at the end of the line of "...." there is no page
> > number.
>
> There's nothing wrong with your table, just a deficiency
> in the current version of FOP.
> See the second paragraph of this message:
>
> http://sources.redhat.com/ml/docbook-apps/2002-q1/msg00755.html
>
> Hugues suggests commenting out lines in formal.xsl, but instead
> you can add a replacement template for 'table' in your
> customization and not edit the original xsl files.  I
> copied the template with match="table" from formal.xsl to
> my XSL customization file and commented out these lines:
>
> <!--
>     <fo:table-and-caption id="{$id}"
>                           xsl:use-attribute-sets="formal.object.properties"
>                           keep-together.within-column="1">
>       <fo:table-caption>
> -->
>         <fo:block xsl:use-attribute-sets="formal.title.properties">
>           <xsl:apply-templates select="." mode="object.title.markup"/>
>         </fo:block>
> <!--
>       </fo:table-caption>
> -->
>       <fo:table>
>         <xsl:call-template name="table.frame"/>
>         <xsl:if test="count($prop-columns) != 0">
>           <xsl:attribute name="table-layout">fixed</xsl:attribute>
>         </xsl:if>
>         <xsl:apply-templates select="tgroup"/>
>       </fo:table>
> <!--
>     </fo:table-and-caption>
> -->
>
>
> That restored tables, and the caption is there.

Don't you loose the id attribute from fo:table-and-caption this way? I
guess this id is important for getting working hyperlinks within the
resulting pdf. I haven't tried it out yet, but would it be sufficient to
add the id to the fo:block, that contains the actual caption?

Inspired by Norm's fo-path-for-fop.xsl -- which is of course obsolete as
of Fop-0.20.3rc -- I created a similar post-transform stylesheet which
handles the table-and-caption deficiency of Fop-0.20.3rc while trying to
keep hyperlinks and page references to tables working.

Why did I use a post-transform stylesheets instead of overriding the
corresponding xsl:templates in a driver file?

Because I think db-xsl generates xsl-fo according to the recent
recommendation which is very good. Doing so "motivates" development of fo
renderers to meet the specs. Furthermore there are renderers besides Fop
which don't have the same deficiencies (but maybe others, alas). Sure, one
could easily make a driver for every other renderer. But if you experiment
or need e.g. pdf output from different renderers for the same docbook
document, it would take much more time to transform the whole document x
times. Generating "right" fo and patching the fo for different renderers
seems to be of much less effort to me.

Steffen.

-- 
  http://w3studi.informatik.uni-stuttgart.de/~maiersn/
mailto:Steffen.Maier@studserv.uni-stuttgart.de

===== fo-patch-for-fop_0.20.3rc.xsl =====

<?xml version="1.0"?>
<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">

  <!-- try to achieve as much output as possible with broken Fop-0.20.3rc -->

<xsl:output method="xml"
  />

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

<!-- ignore fo:table-and-caption because Fop won't render tables otherwise -->
<xsl:template match="fo:table-and-caption">
  <xsl:apply-templates/>
</xsl:template>

<!-- ignore fo:table-caption because surrounding fo:table-and-caption was skipped -->
<xsl:template match="fo:table-caption">
  <xsl:apply-templates mode="fo:table-caption"/>
</xsl:template>

<!-- fetch @id of skipped surrounding fo:table-and-caption for linking -->
<xsl:template match="fo:block" mode="fo:table-caption">
  <xsl:element name="{name(.)}">
    <xsl:attribute name="id">
      <xsl:value-of select="ancestor::fo:table-and-caption/@id"/>
    </xsl:attribute>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<!-- a clever idea that doesn't quite work. fop 0.20.1 doesn't understand % -->
<!-- and fop 0.20.2 doesn't work for me at all... -->
<!-- mod. by smaier -->
<xsl:template match="fo:table-column">
  <xsl:element name="{name(.)}">
    <xsl:if test="not(@column-width)">
      <xsl:attribute name="column-width">
        <xsl:text>proportional-column-width(1)</xsl:text>
      </xsl:attribute>
    </xsl:if>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

</xsl:stylesheet>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC