且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

XSL-FO在每个节点之后添加新行

更新时间:2023-12-03 18:46:28

如果在node元素上进行匹配并为它们创建fo:block,则可以更好地控制事物.您拥有的解决方案是将它们放入内联中,另一个答案可以解决,但对它们的控制较少.

You would have better control of things if you matched on the node element and created an fo:block for them. The solution you have is for putting them inline, the other answer will work but yield less control of them.

如果您希望每个人都换行(这意味着您想要一个新的街区),则将每个人都放在自己的街区中.

If you want each one in a new line (which means you want a new block area), then put each one is it's own block.

这意味着,您将在XSL中执行以下操作:

Meaning, you would do somewhere in your XSL:

 <xsl:template match="node">
     <fo:block>
         <xsl:apply-templates/>
     </fo:block>
 </xsl:template>

您应该没有理由使用value-of select =.".上面的代码将为您做到这一点,并且如果您将其扩展到在node元素中包含某些内容,那么您的所有内容都将全部设置好.

There should be no reason for you to use value-of select=".". The above will do that for you and if you ever expand to have something inside of the node element, then your are still all set.