Good morning!
Thanks for looking. I have some lovely MIL-STD-40051 XML (DTD 6.5.3) and a style sheet question.
This is my first encounter with a list-block. I found this site helpful to get my head around the concept.
This image was particularly helpful.
visual guide to list-block layout
If this was a table, I would say the problem is that the two cells are aligning to the TOP of the cell, and I need them to align to the BOTTOM of the cell.
But it's a list-block, and ... I have no idea how to implement that with a list-block. I spent about four hours experimenting, no joy, and have decided to try and ask the community for help.
DTD snippet, simplified a little:
<!ELEMENT tsindx.messageword (applicable?, title, (tsindx.messageword-category+ | tsindx.messageword-entry+))
<!ELEMENT tsindx.messageword-category (applicable?, title, tsindx.messageword-entry+)>
<!ELEMENT tsindx.messageword-entry (applicable?, messageword+, xref)>
Style sheet (xsl) snippets:
<xsl:template match="tsindx.messageword">
<fo:block font-family="sans-serif" font-size="10pt" provisional-distance-between-starts="29pc" provisional-label-separation="0pt" space-before.conditionality="discard" space-before.maximum="12pt" space-before.minimum="8pt" space-before.optimum="10pt">
[snip]
<xsl:template match="tsindx.messageword-category">
<fo:block font-weight="bold" space-before.conditionality="discard" space-before.maximum="8pt" space-before.minimum="5pt" space-before.optimum="6pt" span="all" start-indent="0pt">
<xsl:value-of select="title"/>
<xsl:apply-templates select="tsindx.messageword-entry"/>
</fo:block>
</xsl:template>
<!-- this is the bit that produces my output -->
<xsl:template match="tsindx.messageword-entry">
<fo:list-block>
<fo:list-item>
<fo:list-item-label>
<fo:block start-indent="6pt" space-after="8pt">
<xsl:number count="tsindx.messageword-entry" format="1." from="tsindxwp" level="any"/>
<xsl:text disable-output-escaping="no"> </xsl:text>
<xsl:apply-templates select="messageword"/>
<fo:leader leader-pattern="dots"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body relative-align="baseline">
<xsl:apply-templates select="xref"/>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
( is an em-space, slightly wider than normal spaces.)
PDF output looks like this:
--PDF--
AIR SYSTEM TROUBLESHOOTING
During Operation . . . . . . . . . . . . . . . . . . . . . . . . .
BRAKE SYSTEM TROUBLESHOOTING
Trailer Brakes Overheat, Drag, Or Do Not Release . . . . . . . . WP 0025
Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not Apply WP 0026
Vehicle Brakes Overheat, Drag, Or Do Not Release . . . . . . . . WP 0028
Vehicle Brakes Unevenly, Pulls To One Side, Or Do Not Apply .. . WP 0029
--end pdf--
Generally correct, but #1 and #3 need some work.
FIRST PROBLEM:
If this was a table, I would say the cells need to be aligned bottom rather than aligned top. But it's a list-block, and apparently they work differently....
The list-label-item (title) is long enough to wrap down to a second line, which is fine.
The list-item-body WP 0021 is populating aligned with the top of the list-item-label (title) instead of aligned with the bottom of the list-item-label, at the end of the leader dots.
I'm getting this:
During Operation . . . . . . . . . . . . . . . . . . . . . . . . .
where the list-item-body is aligned with the upper line of list-item-label and not the leader dots.
The reviewers are complaining that it looks like
"Air System Does Not Reach Operating Pressure, Or Loses Pressure WP 0021 During Operation"
and I can't really disagree.
What I want is this:
During Operation . . . . . . . . . . . . . . . . . . . . . . . . . WP 0021
where if the list-item-label title is long enough to wrap, the list-item-body populates after the leader dots, aligned with the bottom of list-item-label.
I have been editing the style sheet with notepad++ and Oxygen. Oxygen gives me a ridiculous number of attribute options, none of which have accomplished what I want.
SECOND PROBLEM (lower priority but still would be nice to fix)
It would be nice to be able to limit the length of list-item-label field to be a little shorter and wrap the text to a second line. The lack of a leader line for long titles looks odd.
Current output is this:
Where list-item-label runs all the way to list-item-body and there is no leader line.
This would be better:
Not Apply. . . . . . . . . . . . . . . . . . . . . .. . . . . . . WP 0026
With list-item-label constrained a little shorter so there is always a leader line.
Fixing problem #2 would be contingent on fixing problem #1 and getting the list-item-body to align with the bottom of list-item-label .
(Sorry this is verbose; I'm trying to make sure I have a full explanation of the issues.)
Thanks in advance for any help you can provide.
Dan
I have tried a bunch of different attribute changes for the two fo:blocks. So far, no success.
It seems to me that only the number would need to go in the fo:list-item-label
, and that the entry text, the leader(s), and the xref
could go in the fo:list-item-body
.
For discussion on how to use fo:leader
, see the examples at https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#axf.leader-expansion and the fo:leader
samples from the XSL-FO Samples Collection at https://www.antennahouse.com/xsl-fo-samples. Particularly see https://www.antennahouse.com/xsl-fo-samples#axf-last-right-justify-1, with PDF at https://www.antennahouse.com/hubfs/xsl-fo-sample/line/axf-last-right-justify-1.pdf?hsLang=en. The fo:block-container
sample from that is:
<fo:block-container text-align="justify" text-align-last="right">
<fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing cons equat elit...
<fo:leader />
<fo:leader leader-length.optimum="100%" />
<fo:inline keep-together.within-line="always">Antenna House</fo:inline>
</fo:block>
</fo:block-container>
If you are using Antenna House Formatter, you could instead use axf:tab-stops
, as also shown in that sample.