Definition list spacing

Here should go questions about transforming XML with XSLT and FOP.
daveg
Posts: 11
Joined: Fri Oct 15, 2010 11:48 am

Definition list spacing

Post by daveg »

Hi,

Is there a way I can edit the table attributes for the definition list so that the dl and dd elements print beside each other in PDF output?
At the moment the dl and dd elements are printing in evenly sized columns.
I'd like the dl column to autosize to the largest entry and the dd column to take up the rest of the width.

I've a feeling this could be part of the problem too...
When I try print a definition list I get the following warnings:

Code: Select all

[java] 832 WARN [ main ] org.apache.fop.apps.FOUserAgent - "fo:list-item-label" is missing child elements. Required content model: marker* (%block;)+ (See position 26:-1)
[java] 835 WARN [ main ] org.apache.fop.apps.FOUserAgent - The following feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table) (See position 29:-1)
[java] 849 WARN [ main ] org.apache.fop.apps.FOUserAgent - The following feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table) (See position 30:-1)
Any help appreciated.

Thanks,
Dave
Radu
Posts: 9439
Joined: Fri Jul 09, 2004 5:18 pm

Re: Definition list spacing

Post by Radu »

Hi Dave,

The XSLT stylesheet used for constructing <dl> lists can be found here:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/tables.xsl

The XSLT template is this one:
<xsl:template match="*[contains(@class, ' topic/dl ')]">
...................


It relies on attribute sets from the XSLT:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/cfg/fo/attrs/tables-attr.xsl

For example if in this attribute-set:

<xsl:attribute-set name="dl">
........


you set the table-layout to auto like:

Code: Select all


 <xsl:attribute-set name="dl">
<!--DL is a table-->
<!--<xsl:attribute name="width">100%</xsl:attribute>-->
<xsl:attribute name="table-layout">auto</xsl:attribute>
<xsl:attribute name="space-before.optimum">5pt</xsl:attribute>
<xsl:attribute name="space-after.optimum">5pt</xsl:attribute>
</xsl:attribute-set>
Then when transforming to PDF using XEP the output should have the <dt> and <dl> closer together.

Unfortunately FOP does not support auto table-layout.
Maybe you can experiment setting a smaller value to the table width or by using different text alignments.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
daveg
Posts: 11
Joined: Fri Oct 15, 2010 11:48 am

Re: Definition list spacing

Post by daveg »

Thanks Radu,

I added the following line to the tables-attr.xsl file and it has lined the columns up much better:
<xsl:attribute name="width">65px</xsl:attribute>

Code: Select all

<xsl:attribute-set name="dlentry.dt">
<xsl:attribute name="width">65px</xsl:attribute>
<xsl:attribute name="relative-align">baseline</xsl:attribute>
</xsl:attribute-set>
I also commented out the following line in the same file but not sure if that matters to be honest.
<!-- <xsl:attribute name="width">100%</xsl:attribute>-->

Code: Select all

<xsl:attribute-set name="dl">
<!--DL is a table-->
<!-- <xsl:attribute name="width">100%</xsl:attribute>-->
<!-- <xsl:attribute name="table-layout">auto</xsl:attribute>-->
<xsl:attribute name="space-before.optimum">5pt</xsl:attribute>
<xsl:attribute name="space-after.optimum">5pt</xsl:attribute>
Post Reply