fo:list-block alignment problem, (40051)
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 4
- Joined: Wed May 08, 2024 12:40 am
fo:list-block alignment problem, (40051)
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:
2024-06-25_15-27-01_output.png
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
You do not have the required permissions to view the files attached to this post.
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: fo:list-block alignment problem, (40051)
Post by julien_lacour »
Hello,
Could you indicate which FO processor you are using to obtain your PDF? (Apache FOP, Antenna House, etc.)
I think the structure should look more like this, with the actual content in the <fo:list-item-body> element:
You should maybe try to create a <fo:inline-container> for your content, it should help you aligning the texts.
For the "3. Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not Apply WP 0026" structure I don't think there's an easy way to force the leader to display and to add a line-break in the text.
Regards,
Julien
Could you indicate which FO processor you are using to obtain your PDF? (Apache FOP, Antenna House, etc.)
I think the structure should look more like this, with the actual content in the <fo:list-item-body> element:
Code: Select all
<fo:list-block provisional-label-separation="6pt" provisional-distance-between-starts="24pt">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>1. </fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
<fo:inline>
Air System Does Not Reach Operating Pressure, Or Loses Pressure During Operation
</fo:inline>
<fo:leader leader-pattern="dots"/>
<fo:inline>
WP 0021
</fo:inline>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
For the "3. Trailer Brakes Unevenly, Pulls To One Side, Or Brakes Do Not Apply WP 0026" structure I don't think there's an easy way to force the leader to display and to add a line-break in the text.
Regards,
Julien
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service