samp17
samp17

Reputation: 577

XSLT region-body with multiple columns, force block to start on a new column

I am using XSLT to create templates for generating PDF. I am wanting my landscape page split into three columns, which I do using:

<fo:layout-master-set>
     <fo:simple-page-master master-name="page" page-height="210mm" page-width="297mm"
     margin="5mm 25mm 5mm 25mm">
     <fo:region-body column-count="3" margin="30mm 0mm 30mm 0mm"/>
     </fo:simple-page-master>
</fo:layout-master-set>

In one of my templates, I have a for-each function to write a block. When I generate my pdf, this works and my data is spread over the multiple columns. However due to the nature of my blocks, looks a mess.

Is there a way that every 'for-each' section coud start on a new column? I cannot find any way to do this.

Upvotes: 0

Views: 121

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

Use break-before="column" (see https://www.w3.org/TR/xsl11/#break-before) on the first block. Something like:

<fo:block>
  <xsl:if test="position() = 1">
    <xsl:attribute name="break-before">column</xsl:attribute>
  </xsl:if>
  ...

Upvotes: 1

Related Questions