docbook-apps

  • 1.  Changing floatstyle of figures/tables

    Posted 04-02-2011 10:41
    For FO output of a book, when I select one column for body text (instead of
    two for example), I'd like some code to change the floatstyle of figures,
    tables and examples (any formal object) from "before" to "none". I have
    coded the floatstyle of formal objects in XML files - some are "before",
    some are "none". Can I change all these to "none"? I tried the following
    code, but all I get in the PDF is "false" where the figures should be.



    <xsl:template match="*[@floatstyle = 'before']">
    <xsl:choose>
    <xsl:when test="column.count.body = '1'">
    <xsl:value-of select="@floatstyle = 'none'"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="@floatstyle = 'none'"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>

    Thanks,
    Dave Gardiner



  • 2.  Re: [docbook-apps] Changing floatstyle of figures/tables

    Posted 04-02-2011 15:24
    Hi,

    On Sat, Apr 2, 2011 at 16:10, redlettucemail
    <redlettucemail@mailscan.acenet.net.au> wrote:
    > For FO output of a book, when I select one column for body text (instead of
    > two for example), I'd like some code to change the floatstyle of figures,
    > tables and examples (any formal object) from "before" to "none". I have
    > coded the floatstyle of formal objects in XML files - some are "before",
    > some are "none". Can I change all these to "none"? I tried the following
    > code, but all I get in the PDF is "false" where the figures should be.
    >
    >
    >     <xsl:template match="*[@floatstyle = 'before']">
    >     <xsl:choose>
    >       <xsl:when test="column.count.body = '1'">
    >         <xsl:value-of select="@floatstyle = 'none'"/>
    >       </xsl:when>
    >       <xsl:otherwise>
    >         <xsl:value-of select="@floatstyle = 'none'"/>
    >       </xsl:otherwise>
    >     </xsl:choose>
    >   </xsl:template>

    The ‘xsl:value-of’ elements are just going to put the result of the
    expression ‘@floatstyle = 'none'’ in the output document, i.e. ‘true’
    if ‘@floatstyle’ is ‘none’, ‘false’ otherwise. I /think/ you can
    achieve the preprocessing you actually want using variables. Here’s
    one (untested) possible solution:

    ,----
    | <xsl:template match="*[@floatstyle = 'before']">
    | <xsl:variable name="preprocessed">
    | <xsl:copy>
    | <xsl:attribute name="floatstyle">none</xsl:attribute>
    | <xsl:apply-templates select="@*[not(local-name() =
    'floatstyle')] | node()"/>
    | </xsl:copy>
    | </xsl:variable>
    |
    | <xsl:choose>
    | <xsl:when test="column.count.body = '1'">
    | <xsl:apply-templates select="$preprocessed"/>
    | </xsl:when>
    | <xsl:otherwise><xsl:apply-imports/></xsl:otherwise>
    | </xsl:choose>
    | </xsl:template>
    `----

    Hope this doesn’t break anything. ;-)

    Aankhen