首页 > 解决方案 > XSF-FO .How 忽略某些模板中的静态内容?

问题描述

我是 XSL-FO 的初学者。我想在某些页面中显示我的静态内容,而不是在其他页面中显示。

我的 XSL 是这样的:

 <xsl:template match="analyseData">
        <fo:root language="EN">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="simpleA5"
                    page-height="210mm" page-width="297mm" margin-top="0mm"
                    margin-bottom="5mm" margin-left="0mm" margin-right="0mm">
                    <fo:region-body margin-top="30mm" margin-bottom="10mm" margin-left="5mm" margin-right="5mm" />
                    <fo:region-before extent="0mm" />
                    <fo:region-after extent="10mm" />
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="simpleA5">
                <fo:static-content flow-name="xsl-region-after">
                    <fo:block margin-left="5mm" margin-right="5mm">
                        <fo:table border-top="1.5px solid" border-top-color="#B22222">
                            <fo:table-column column-width="95mm" />
                            <fo:table-column column-width="95mm" />
                            <fo:table-column column-width="95mm" />
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell text-align="left" padding-top="0.25cm">
                                        <fo:block>
                                            Entité
                                            Exercice
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell text-align="center" padding-top="0.25cm">
                                        <fo:block>
                                            24 July 2017
                                        </fo:block>
                                    </fo:table-cell>

                                    <fo:table-cell text-align="right" padding-top="0.25cm">
                                        <fo:block>
                                            Page
                                            <fo:page-number />
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>
                    </fo:block>
                </fo:static-content>
                <fo:static-content flow-name="xsl-region-before">
                    <fo:block-container width="297mm" height="25mm"
                        background-color="#DCDCDC">

                        <fo:block margin-left="5mm" margin-top="5mm"
                            margin-right="2mm">
                            <fo:table>
                                <fo:table-column column-width="35mm" />
                                <fo:table-column column-width="25mm" />
                                <fo:table-column column-width="40mm" />
                                <fo:table-column column-width="40mm" />
                                <fo:table-column column-width="50mm" />
                                <fo:table-column column-width="25mm" />
                                <fo:table-column column-width="70mm" />

                                <fo:table-body>
                                    <fo:table-row>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="2.6cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt">
                                                        Mode opératoire
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="2cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" color="#B22222" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt" color="#B22222">
                                                        Synthèse
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="3cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt" font-weight="bold">
                                                        Tests
                                                        Techniques
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="3cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt">
                                                        Tests Comptables
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="3.5cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt">
                                                        Réconcilation
                                                        comptable
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="2cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt">
                                                        Annexes
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </fo:table-body>
                            </fo:table>
                        </fo:block>
                    </fo:block-container>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body" border-collapse="collapse"
                    reference-orientation="0">
                    <xsl:call-template name="firstPage" />
                    <xsl:call-template name="modeOper" />
                    <xsl:call-template name="synthese" />
                    <xsl:call-template name="ResultTech" />
                    <xsl:call-template name="detailsTestTech" />
                    <xsl:apply-templates select="ruleTechData" />
                    <xsl:call-template name="detailsTestComp" />
                    <xsl:call-template name="detailsTestCad" />
                    <xsl:apply-templates select="ruleCadData" />

                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>

我只想在某些模板中显示静态内容。例如在:

ResultTech 规则TechData 规则CadData

有人可以用 XSL-FO 中的表达式指导我如何解决这个问题吗?或者,如果有人知道另一种方法来做到这一点。

标签: xmlpdfxsl-fo

解决方案


您必须创建一个没有静态内容的新页面序列。然后从该页面序列中调用您想要的模板。


推荐阅读