DL Widths / Replace with blocks
Posted: Wed Nov 25, 2015 7:07 pm
Hi,
I am trying to use DL elements in my DITA and have the following:
Using the standard Dita 1.8 engine with FOP, this is rendered as a table with the DT and DD in columns with 50% each.
Ideally, I would like the DL list rendered like this (but other solutions are acceptable):
My list appears as above, but it is 100% wide and starts left of the above text. For example (... show indent)
In my tables-attr.xsl, I've set the following:
But niether width nor start-indent have any effect. Only color:blue has any effect.
How can I either:
a) use DL as a table, but have dynamic column widths (I've read that this isn't possible with FOP
b) use DL as blocks, but set the width and have it indented with the surrounding text (like notes or tables)
Thanks
Rich
I am trying to use DL elements in my DITA and have the following:
Code: Select all
<dl>
<dlentry>
<dt>Lorem ipsum</dt>
<dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt</dd>
</dlentry>
<dlentry>
<dt>At vero</dt>
<dd>At vero eos et accusam et justo duo dolores et ea rebum</dd>
</dlentry>
</dl>
Ideally, I would like the DL list rendered like this (but other solutions are acceptable):
So in my tables.xsl, I've replaced all table blocks with fo:blocks as shown here:Lorem ipsum
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt
At vero
At vero eos et accusam et justo duo dolores et ea rebum
Code: Select all
<!--Definition list-->
<xsl:template match="*[contains(@class, ' topic/dl ')]">
<fo:block xsl:use-attribute-sets="dl">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="*[contains(@class, ' topic/dlhead ')]"/>
<fo:block xsl:use-attribute-sets="dl__body">
<xsl:choose>
<xsl:when test="contains(@otherprops,'sortable')">
<xsl:apply-templates select="*[contains(@class, ' topic/dlentry ')]">
<xsl:sort select="opentopic-func:getSortString(normalize-space( opentopic-func:fetchValueableText(*[contains(@class, ' topic/dt ')]) ))" lang="{$locale}"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[contains(@class, ' topic/dlentry ')]"/>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' topic/dl ')]/*[contains(@class, ' topic/dlhead ')]">
<fo:block xsl:use-attribute-sets="dl.dlhead">
<xsl:call-template name="commonattributes"/>
<fo:block xsl:use-attribute-sets="dl.dlhead__row">
<xsl:apply-templates/>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' topic/dlhead ')]/*[contains(@class, ' topic/dthd ')]">
<fo:block xsl:use-attribute-sets="dlhead.dthd__cell">
<xsl:call-template name="commonattributes"/>
<fo:block xsl:use-attribute-sets="dlhead.dthd__content">
<xsl:apply-templates/>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' topic/dlhead ')]/*[contains(@class, ' topic/ddhd ')]">
<fo:block xsl:use-attribute-sets="dlhead.ddhd__cell">
<xsl:call-template name="commonattributes"/>
<fo:block xsl:use-attribute-sets="dlhead.ddhd__content">
<xsl:apply-templates/>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' topic/dlentry ')]">
<fo:block xsl:use-attribute-sets="dlentry">
<xsl:call-template name="commonattributes"/>
<fo:block xsl:use-attribute-sets="dlentry.dt">
<xsl:apply-templates select="*[contains(@class, ' topic/dt ')]"/>
</fo:block>
<fo:block xsl:use-attribute-sets="dlentry.dd">
<xsl:apply-templates select="*[contains(@class, ' topic/dd ')]"/>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' topic/dt ')]">
<fo:block xsl:use-attribute-sets="dlentry.dt__content">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' topic/dd ')]">
<fo:block xsl:use-attribute-sets="dlentry.dd__content">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
.....Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,
.....vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim
.....qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt
At vero
At vero eos et accusam et justo duo dolores et ea rebum
In my tables-attr.xsl, I've set the following:
Code: Select all
<xsl:attribute-set name="dl">
<!--DL is a table-->
<xsl:attribute name="width">300pt</xsl:attribute>
<xsl:attribute name="start-indent">20pt</xsl:attribute>
<xsl:attribute name="space-before">5pt</xsl:attribute>
<xsl:attribute name="space-after">5pt</xsl:attribute>
<xsl:attribute name="color">blue</xsl:attribute>
</xsl:attribute-set>
How can I either:
a) use DL as a table, but have dynamic column widths (I've read that this isn't possible with FOP
b) use DL as blocks, but set the width and have it indented with the surrounding text (like notes or tables)
Thanks
Rich