Changing line spacing in Docbook variablelists

Here should go questions about transforming XML with XSLT and FOP.
rmcilvride
Posts: 3

Changing line spacing in Docbook variablelists

Mon Aug 15, 2016 10:07 pm

I want to remove all line spacing for list items in a Docbook document using Apache FOP XSLT. I've been able to do this successfully, except for the space between the term and listitem in a variablelist. I have made a number of attempts in my custom stylesheet, but no luck.

For example, one part of my Docbook XML code looks like this:

Code: Select all

<varlistentry>
    <term><parameter moreinfo="none">modbus</parameter></term>
    <listitem>
    <para>The modbus instance pointer. Always enter <literal
        moreinfo="none">modbus</literal> for this
        parameter</para>
    </listitem>
</varlistentry>

My custom stylesheet currently contains this:

Code: Select all

    <xsl:attribute-set name="list.item.spacing">
        <xsl:attribute name="space-before.optimum">0em</xsl:attribute>
        <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
        <xsl:attribute name="space-before.maximum">0em</xsl:attribute>
        <xsl:attribute name="space-after.optimum">0em</xsl:attribute>
        <xsl:attribute name="space-after.minimum">0em</xsl:attribute>
        <xsl:attribute name="space-after.maximum">0em</xsl:attribute>
    </xsl:attribute-set>
   
   <xsl:template match="d:varlistentry" mode="vl.as.blocks">
      <xsl:variable name="id">
         <xsl:call-template name="object.id"/>
      </xsl:variable>
       
      <fo:block id="{$id}" xsl:use-attribute-sets="variablelist.term.properties
         list.item.spacing" 
         keep-together.within-column="always"
         keep-with-next.within-column="always"
         space-after.minimum="0pt"
         space-after.maximum="0pt"
         space-after.optimum="0pt"
         space-after.precedence="force"
         >   
         <xsl:apply-templates select="d:term"/>
      </fo:block>
       
      <fo:block
         space-before.minimum="0pt"
         space-before.maximum="0pt"
         space-before.optimum="0pt"
         space-before.precedence="force"
         >
         <xsl:attribute    name="margin-{$direction.align.start}">0.25in</xsl:attribute>
         <xsl:apply-templates select="d:listitem"/>
      </fo:block>
   </xsl:template>

Here is what my output looks like. As you can see, all of the line spacing is removed, except for the area between the term and the listitem. Can anyone help me remove that space?
Image
Radu
Posts: 5221

Re: Changing line spacing in Docbook variablelists

Wed Aug 17, 2016 11:11 am

Hi,

Maybe you should look inside the generated XSL-FO file, see if your customization is applied and if there are other margins which should interfere.
As a recommendation, the Docbook Apps Mailing list (https://lists.oasis-open.org/archives/docbook-apps/) is probably a better channel where to ask Docbook customization related-questions.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
rmcilvride
Posts: 3

Re: Changing line spacing in Docbook variablelists

Wed Aug 17, 2016 9:05 pm

Hi Radu,

Thanks for the quick reply. I'm pretty sure my customizations apply, because I can change the font of the term to bold. But the generated XSL-FO file might have some clues to the problem. Where would I find it? In any case, I'm acting on your suggestion and have asked about this on the Docbook Apps mailing list.

Best regards,

Bob
Radu
Posts: 5221

Re: Changing line spacing in Docbook variablelists

Thu Aug 18, 2016 7:59 am

Hi Bob,

If you are using Oxygen and you edit the Docbook to PDF transformation scenario, in the FO Processor tab you can uncheck the Perform FO Processing... checkbox and in the Output tab you can change the extension of the saved file to ".fo", then decide to open it in the editor at the end of the transformation.

I'm also adding a link to the answer you received on the Docbook mailing list, in case somebody may find it useful:

https://lists.oasis-open.org/archives/docbook-apps/201608/msg00019.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
rmcilvride
Posts: 3

Re: Changing line spacing in Docbook variablelists

Thu Aug 18, 2016 4:38 pm

Hi Radu,

That's a great tip for viewing the generated XSL-FO file. Thank you! And thanks for linking to the Docbook-Apps message. I can add that as Bob Stayton mentioned, his customization applies to all the paras in a varlistentry, not just the first one. I have had to make additional modifications to get exactly what I need, but his response got me past the main issue I was having.

Best regards,

Bob

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest