[xsl] adjust width of block to previous block

Subject: [xsl] adjust width of block to previous block
From: Mathis Mörke <mathis.moerke@xxxxxxxxxxxxxx>
Date: Fri, 15 Jul 2011 17:07:01 +0200
Dear all,

I am using Apache FOP version 0.95. Furthermore I am using xsl-fo to
generate pdf out of Matlab (matlab generates an xml-file and I use a
xsl-fo file as style sheet)

I don't know how to adjust the width of a next block to the previous
block. I have an external graphic in a block and want the next block
to have the same size as the block containing the external graphic.


<fo:block space-after="3mm"> <!-- block with external graphic which
width is dynamic -->
   <fo:external-graphic>
    <xsl:attribute name="src">url('<xsl:value-of
select="@filename"/>')</xsl:attribute>
    <xsl:attribute name="content-height">
     <xsl:choose>
      <xsl:when test="@height">
       <xsl:value-of select="@height" />
      </xsl:when>
      <xsl:otherwise>100%</xsl:otherwise>
     </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="content-width">
     <xsl:choose>
      <xsl:when test="@width">
       <xsl:value-of select="@width" />
      </xsl:when>
      <xsl:otherwise>100%</xsl:otherwise>
     </xsl:choose>
    </xsl:attribute>
   </fo:external-graphic>
  </fo:block>
  <fo:block font-size="8pt" text-align="justify" wrap-option="wrap" >
<!-- width of this block must be equal to the previous block in order
to have the text (@caption) in line with the graphic
   <xsl:value-of select="@caption" />
  </fo:block>

Thanks for your help,
Mathis

Current Thread