apachefop将两个元素放在一起不起作用
我有以下xslt:apachefop将两个元素放在一起不起作用,apache,xslt,Apache,Xslt,我有以下xslt: <xsl:template match="P"> <fo:block> 1.1 First Image </fo:block> <xsl:apply-templates /> </xsl:template> <xsl:template match="figure"> <fo:block margin-top="-0.30in" kee
<xsl:template match="P">
<fo:block>
1.1 First Image
</fo:block>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="figure">
<fo:block margin-top="-0.30in" keep-with-previous.within-page="always">
<fo:external-graphic>
<xsl:attribute name="src"> <xsl:value-of select="abc.svg" />
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</xsl:template>
1.1第一图像
这两个模板都将在递归方法中调用
我的输出是:
P标签出现在一个有空间的页面中。因为数字很大,所以会在下一页显示。我希望他们在一起
尝试过的解决方案:继续使用,之后断页,之后断页
坚持下去是行不通的。其他人正在为每个P标记创建新页面,尽管前一个标记中有空间。
我正在使用FOP1.0生成PDF输出
请帮忙
提前感谢。更改
<xsl:template match="P">
<fo:block>
1.1 First Image
</fo:block>
<xsl:apply-templates />
</xsl:template>
1.1第一图像
到
1.1第一图像
嗨,Joel,这对我也不起作用。P标签仍在一页中,图形在下一页中。pdf中的每个图形上方都有大量空间。大约高达0.71英寸,看起来不太好。请尝试阅读此()。这是一篇旧文章,但可能会有帮助。我已经看到了这个链接。他们说“keep”属性只在表行中受支持。但是我的xslt是非常动态的。我已经为50个标记编写了模板,它们将仅由xsl:apply templates/调用。因此,我无法创建使用“keep”的表。请帮助我找到其他解决方案。我使用了keep with previous=“always”。它成功了。谢谢:)
<xsl:template match="P">
<fo:block keep-with-next.within-page="always">
1.1 First Image
</fo:block>
<xsl:apply-templates />
</xsl:template>