Search code examples
xslt-1.0line-breaksxsl-fo

Adding LineBreak in List-item XSLT


Can someone tell me how I can add a break between the item-label and the body. So first I want the firstname on a line. then a line with nothing and then the name John on a new line: this is the code I have tried a lot but nothing works: I am unsing Apache FOP to turn mij XSL into PDF

<fo:list-item>
  <fo:list-item-label><fo:block>FirstName:</fo:block></fo:list-item-label>
  <fo:list-item-body><fo:block>John</fo:block></fo:list-item-body>
</fo:list-item>

Thanks!


Solution

  • As far as I know, list-item is designed for placing elements side-by-side, not above each other. Anyway, you don't need the list-item at all. Just create 2 blocks with the information you need, and they'll be placed one above the other automatically.

    Specify space-after on the first block to get the empty line:

    <fo:block space-after="12pt">