0

ページの最後で、「examClin」のラベルを分離したくありません。そのため、ラベルがページの最後に到着した場合、examClin の @label に添付されるのは 1 行で、examClin の行は 1 つだけです... または、両方の要素が次のページに移動する必要があります。私は十分に明確ですか?

さまざまな要素...ページの最後に到達します

 <fo:table-row>
   <fo:table-cell number-columns-spanned="5">
      <fo:block space-before="2mm">
           <xsl:value-of select="./examClin/@label"/>: </fo:inline>
       </fo:block>
   </fo:table-cell>
  </fo:table-row>
 <fo:table-row>
  <fo:table-cell number-columns-spanned="5" padding-top="2mm" padding-bottom="2mm"
                                    padding-left="1mm" padding-right="1mm">
    <fo:block white-space-collapse="false" font-style="italic" >
             <xsl:value-of select="./examClin/child::text()"/>
    </fo:block>
   </fo:table-cell>
  </fo:table-row>
4

2 に答える 2

0

ありがとうアーロン。しかし、非常に長いテキストの場合、最初の行だけでなく、すべてがまとまってしまうのではないかと心配しています。その結果、前のページに長い白いブロックが残ることがあります。

次のテンプレートを作成しました: アイデアは、最初の行がどうなるかを見つけることです: 最初の 75 文字ですが、最初の 75 文字の前に改行が見つかった場合は、最初の改行の前の文字列を取ります。

<xsl:template name="elem3">
    <xsl:choose>
        <xsl:when test="child::text()">
            <xsl:variable name="test0" select="substring(child::text(),1,100000)"/> 
            <xsl:variable name="test1" select="substring(child::text(),0,75)"/> 
            <xsl:variable name="test2" select="substring(child::text(),75,100000)"/>
            <xsl:variable name="test3" select="substring-before($test2,' ')"/>
            <xsl:variable name="test4" select="concat($test1,$test3)"/>
            <xsl:variable name="test5" select="substring-after($test2,' ')"/>
             <xsl:variable name="test6" select="substring-before($test1,'&#10;')"/>
           <xsl:variable name="test7" select="substring-after($test0,'&#10;')"/>
            <fo:table-row>
                <fo:table-cell number-columns-spanned="5">
                    <fo:block space-before="2mm">
                        <fo:inline font-weight="bold"><xsl:value-of select="@label"/>: </fo:inline>
                    </fo:block>
                </fo:table-cell>
            </fo:table-row>
            <xsl:choose>
                <xsl:when test="child::text()">
                    <fo:table-row keep-with-previous="always">
                        <fo:table-cell number-columns-spanned="6" padding-top="2mm" padding-left="1mm" padding-right="1mm">
                            <fo:block white-space-collapse="false" font-style="italic" >
                            <xsl:choose>
                                <xsl:when test="contains($test1,'&#10;')"> <xsl:value-of select="$test6"/></xsl:when>
                                <xsl:otherwise><xsl:value-of select="$test4"/></xsl:otherwise>
                            </xsl:choose>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                        <fo:table-cell number-columns-spanned="5" padding-left="1mm" padding-right="1mm">
                            <fo:block white-space-collapse="false" font-style="italic" >
                                <xsl:choose>
                                    <xsl:when test="contains($test1,'&#10;')"><xsl:value-of select="$test7"/></xsl:when>
                                    <xsl:otherwise> <xsl:value-of select="$test5"/></xsl:otherwise>
                                    </xsl:choose>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </xsl:when>
            </xsl:choose>
        </xsl:when>
    </xsl:choose>
</xsl:template>
于 2009-10-13T13:54:28.747 に答える
0

それらを単一のブロックに入れ (つまり、2 つのテーブル行を 1 つにマージする必要があります)、keep-togetherを使用します。

于 2009-10-06T11:22:04.380 に答える