我对XSLFast 3.1.19的布局有问题。它使用xml数据来做报表生成。
每当Interpretation出现在寄存器sum/comment中时,我都需要一个分页符。但它通常不仅仅是xml文本中的Interpretation。比如..。
<sum>
<comment_lt>Interpretation: Negative experience.</comment_lt>
</sum>有没有办法做到每次在comment_lt中显示时都显示解释然后分页符?
这是我的实际代码。
<xsl:call-template name="comment"/>
<xsl:choose>
<xsl:when test="sum/comment_lt='Interpretation'"><fo:table break-after="page"/></xsl:when>
</xsl:choose>致以最好的问候,马塞尔
发布于 2019-09-23 22:37:58
为此,您只能使用xsl:if:
XML:
<root>
<sum>
<comment_lt>Interpretation: Negative experience.</comment_lt>
</sum>
<sum>
<comment_lt>Negative experience.</comment_lt>
</sum>
</root>XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="sum">
<table>
<xsl:if test="contains(comment_lt, 'Interpretation')"><xsl:attribute name="break-after" select="'page'"/></xsl:if>
</table>
</xsl:template>
</xsl:stylesheet>输出:
<?xml version="1.0" encoding="UTF-8"?>
<table break-after="page"/>
<table/>https://stackoverflow.com/questions/58064262
复制相似问题