XSL-FO: setting a fixed block height

Is it possible to set a fixed height for a block regardless of the contents inside it? I have a block that sometimes displays some text, but sometimes it should be empty and maintain the same height:

<xsl:choose> <xsl:when test="$condition"> <fo:block height="30mm"> <xsl:text>TEXTTEXT</xsl:text> </fo:block> </xsl:when> <xsl:otherwise> <fo:block height="30mm"> <xsl:text>&#160;</xsl:text> </fo:block> </xsl:otherwise> </xsl:choose> 
+6
source share
3 answers

The height attribute does not apply to fo:block . To maintain a fixed height, wrap fo:block in fo:block-container :

 <fo:block-container height="30mm"> <fo:block> <xsl:text>&#160;</xsl:text> </fo:block> </fo:block-container> 
+9
source

instead of empty text you can pass . (dot) here. then the height will remain and the point will not be displayed. Not suitable for a solution, but you can attribute it.

0
source

I think you are looking for fo:leader , as indicated in this stackoverflow QA method:

XSL-FO - Empty Block Elements

NTN!

0
source

Source: https://habr.com/ru/post/958909/


All Articles