docbook-apps

  • 1.  font-size for simplelist ?

    Posted 08-30-2012 13:47
    Hi there,

    Does anyone knows how to change the font size of all element in a
    simplelist ? I tried a naive approach:

    <xsl:attribute-set name="simplelist.properties">
    <xsl:attribute name="font-size">
    <xsl:choose>
    <xsl:when test="@role= 'small">10pt</xsl:when>
    <xsl:otherwise>inherit</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    </xsl:attribute-set>

    with no luck.

    I cannot find any references neither on:

    http://docbook.sourceforge.net/release/xsl/1.76.1/doc/fo/lists.html

    nor on:

    http://www.sagehill.net/docbookxsl/SimpleList.html

    Thanks !

    --
    Mathieu



  • 2.  Re: [docbook-apps] font-size for simplelist ?

    Posted 08-30-2012 14:39
    Hi Mathieu,

    On Thu, 30 Aug 2012 15:47:22 +0200
    Mathieu Malaterre <mathieu.malaterre@gmail.com> wrote:

    > Hi there,
    >
    > Does anyone knows how to change the font size of all element in a
    > simplelist ? I tried a naive approach:
    >
    > <xsl:attribute-set name="simplelist.properties">
    > <xsl:attribute name="font-size">
    > <xsl:choose>
    > <xsl:when test="@role= 'small">10pt</xsl:when>
    > <xsl:otherwise>inherit</xsl:otherwise>
    > </xsl:choose>
    > </xsl:attribute>
    > </xsl:attribute-set>
    >
    > with no luck.

    A simplelist is not always that simple despite its name. It can be
    formatted inline, horizontal, or vertical. See the type attribute in the
    TDG[1]. By default, it's vertical.

    A simplelist can hold only member elements. So I guess, the simplest
    way would be to customize the member template. That way you avoid all
    the complexities of the simplelist templates.

    Here is the original member template:

    <xsl:template match="member">
    <xsl:call-template name="simple.xlink">
    <xsl:with-param name="content">
    <xsl:apply-templates/>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:template>

    If you want to change its font size, introduce a fo:block and set the
    font-size attribute:

    <xsl:template match="member">
    <xsl:call-template name="simple.xlink">
    <xsl:with-param name="content">
    <fo:block font-size="10pt">
    <xsl:apply-templates/>
    </fo:block>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:template>

    Even better, define a parameter (let's say member.fontsize) and
    use it in the fo:block as follows:

    <fo:block font-size="{$member.fontsize}">
    <xsl:apply-templates/>
    </fo:block>

    Regardless of the above two methods, the font-size is inherited and
    propagates to other block elements. However, if some other child sets
    its own font size, that will overwrite the above value. As most (all?)
    of the elements allowed in member are inline elements, this seems not
    very likely. Of course, you should check that with your customization.

    The above modification should apply for horizontal and vertical
    simplelists, but not for inline. I haven't tested it, let's hope
    it works as advertised. :)

    Hope that helps.


    ----------
    [1] http://www.docbook.org/tdg/en/html/simplelist.html

    --
    Gruß/Regards,
    Thomas Schraitle