fo:list-block alignment problem, (40051)
Posted: Tue Jun 25, 2024 11:54 pm
Good afternoon!
I have this little snipped of XSL:
Good afternoon!
Thanks for looking. I have some lovely MIL-STD-40051 XML (DTD 6.5.3) and a style sheet question.
Style sheet:
This is my first encounter with a list-block and I found this helpful to get my head around the concept.
https://www.data2type.de/en/xml-xslt-xs ... tion/lists
This image in particular:

PDF output looks like this:
Which is mostly OK, except ... for item 1, the list-item-label (generated by apply-templates select="messageword") is "Air System Does Not Reach Operating Pressure, Or Loses Pressure During Operation" which is really long, and wraps down to a second line. The leader of dots goes out to the right. Which is normal and correct.
but
The list-item-body "WP 0021" (generated by apply-templates select="xref") is aligned with the TOP of the list-item-label, which means the leader line on long list-item-labels just leads to empty space.
It looks like this:
1. Air System Does Not Reach Operating Pressure, Or Loses Pressure WP 0021
During Operation . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .
When what it should look like is:
1. Air System Does Not Reach Operating Pressure, Or Loses Pressure
During Operation . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . .. . . WP 0021
If this was a table, the fix would be to have both cells align bottom rather than align top.
Unfortunately, it's a list. I have no idea how to get the the alignment corrected.
I looked at the style sheet in Oxygen, tsindxwp-v6_5.xsl. There are a bewildering number of possible attributes that can be applied, and so far, I have not found the winning combination. (I've tried about 15 different combinations of attributes so far, no luck. )
I would also like to maybe buffer the line length on generated by apply-templates select="messageword" so that if the list-item-label (messageword) is so long that there is no room for a leader, the style sheet line-breaks the last word to make the list-item-label two lines. So instead of this,
3. Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not Apply WP 0026
something more like this:
3. Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not
Apply . . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . WP 0026
but that is a much lower priority issue, and contingent on getting the first problem solved.
Any ideas would be greatly appreciated.
Thanks,
Dan
I have this little snipped of XSL:
Good afternoon!
Thanks for looking. I have some lovely MIL-STD-40051 XML (DTD 6.5.3) and a style sheet question.
Style sheet:
Code: Select all
<xsl:template match="tsindx.messageword-entry">
<fo:list-block>
<fo:list-item>
<fo:list-item-label>
<fo:block start-indent="6pt">
<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="action | xref | extref | link"/>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
This is my first encounter with a list-block and I found this helpful to get my head around the concept.
https://www.data2type.de/en/xml-xslt-xs ... tion/lists
This image in particular:

PDF output looks like this:
Which is mostly OK, except ... for item 1, the list-item-label (generated by apply-templates select="messageword") is "Air System Does Not Reach Operating Pressure, Or Loses Pressure During Operation" which is really long, and wraps down to a second line. The leader of dots goes out to the right. Which is normal and correct.
but
The list-item-body "WP 0021" (generated by apply-templates select="xref") is aligned with the TOP of the list-item-label, which means the leader line on long list-item-labels just leads to empty space.
It looks like this:
1. Air System Does Not Reach Operating Pressure, Or Loses Pressure WP 0021
During Operation . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .
When what it should look like is:
1. Air System Does Not Reach Operating Pressure, Or Loses Pressure
During Operation . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . .. . . WP 0021
If this was a table, the fix would be to have both cells align bottom rather than align top.
Unfortunately, it's a list. I have no idea how to get the the alignment corrected.
I looked at the style sheet in Oxygen, tsindxwp-v6_5.xsl. There are a bewildering number of possible attributes that can be applied, and so far, I have not found the winning combination. (I've tried about 15 different combinations of attributes so far, no luck. )
I would also like to maybe buffer the line length on generated by apply-templates select="messageword" so that if the list-item-label (messageword) is so long that there is no room for a leader, the style sheet line-breaks the last word to make the list-item-label two lines. So instead of this,
3. Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not Apply WP 0026
something more like this:
3. Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not
Apply . . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . WP 0026
but that is a much lower priority issue, and contingent on getting the first problem solved.
Any ideas would be greatly appreciated.
Thanks,
Dan