0

我想为一张小桌子尝试两列布局。我复制了现有的 simple-page-master 并添加了column-count="2". (为简洁起见,我不包括页眉或页脚。)如果我删除fo:page-sequenceand ,模板会按预期工作,fo:flow但否则我的输出中什么也没有。我尝试用另一个模板替换 numIndex ,但这也失败了。

我正在使用天线之家。一如既往,我很感激任何建议。

<fo:simple-page-master master-name="body-page-two-col" xsl:use-attribute-sets="odd-page-atts">
    <fo:region-body region-name="region-body" xsl:use-attribute-sets="body-atts" column-count="2"/>
</fo:simple-page-master>

<xsl:attribute-set name="odd-page-atts">
        <xsl:attribute name="page-height">11in</xsl:attribute>
        <xsl:attribute name="page-width">8.5in</xsl:attribute>
        <xsl:attribute name="margin-top">1.5pc</xsl:attribute>
        <xsl:attribute name="margin-bottom">1.5pc</xsl:attribute>
        <xsl:attribute name="margin-left">1in</xsl:attribute>
        <xsl:attribute name="margin-right">.5in</xsl:attribute>
    </xsl:attribute-set>

<xsl:attribute-set name="body-atts">
        <xsl:attribute name="margin-top">4.5pc</xsl:attribute>
        <xsl:attribute name="margin-bottom">4.5pc</xsl:attribute>
    </xsl:attribute-set>

    <xsl:template name="numIndex">
        <fo:page-sequence master-reference="body-page-two-col" initial-page-number="auto" format="1">
            <fo:flow flow-name="region-body">
<fo:block>
            <fo:table-and-caption>
                <fo:table-caption>
                    <fo:block>
                        <xsl:text>Numerical Index</xsl:text>
                    </fo:block>
                </fo:table-caption>
                <fo:table>
                <xsl:attribute name="id"><xsl:apply-templates select="ancestor::dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode"/><xsl:text>tbl-numidx001</xsl:text></xsl:attribute>
                    <fo:table-header>
                        <fo:table-row>
                                <fo:table-cell>
                                    <fo:block font-size="11pt" font-style="italic" >                            
                                    <fo:retrieve-table-marker retrieve-class-name="continued-ni" retrieve-boundary-within-table="table"/>
                                </fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-header>
                    <fo:table-body>
                        <fo:table-row>
                            <fo:table-cell>
                                <fo:marker marker-class-name="continued-ni"/>
                                 <fo:marker marker-class-name="continued-ni">
                                    <fo:block text-align="center">Numerical Index&#160; (Continued)
                                    </fo:block>
                                 </fo:marker>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell>
                                <fo:table border-bottom="solid" border-bottom-width=".5pt" 
                border-top="solid" border-top-width=".5pt" font-size="8pt" 
                margin-bottom="8pt" margin-left="3pt" margin-right="3pt" margin-top="8pt" 
                relative-position="static" space-after.maximum="12pt" space-after.minimum="12pt" 
                space-after.optimum="12pt" space-before.maximum="14pt" space-before.minimum="12pt" 
                space-before.optimum="12pt" span="all" table-layout="fixed" table-omit-header-at-break="false" 
                table-omit-footer-at-break="true" text-align="start" white-space-treatment="preserve" 
                width="3.0in" hyphenate="true" cols="4">
                    <fo:table-column column-number="1" column-width="30%"/>
                    <fo:table-column column-number="2" column-width="20%"/>
                    <fo:table-column column-number="3" column-width="20%"/>
                    <fo:table-column column-number="4" column-width="20%"/>
                    <fo:table-header>
                        <xsl:call-template name="NI-HEADER"/>
                    </fo:table-header>
                <fo:table-body>     
                    <xsl:call-template name="SortParts"/>
                </fo:table-body>
            </fo:table>
            </fo:table-cell>
            </fo:table-row>
                </fo:table-body>
                </fo:table>
                </fo:table-and-caption>
                </fo:flow>
</fo:block>
                </fo:page-sequence>
        </xsl:template>

这就是所谓的 numIndex:

<xsl:template match="illustratedPartsCatalog">
            <xsl:apply-templates />
            <xsl:call-template name="numIndex"/>
    </xsl:template>
4

2 回答 2

1

如果我对您的理解正确,您需要一个在常规单列流程中流入两列的表格。由于您使用的是 AH Formatter,因此您可以使用两列fo:block-container来仅包含表格。请参阅https://www.antennahouse.com/product/ahf64/ahf-ext.html#axf.column-count。但是,这不会让您获得“(续)”标记。要做到这一点,你可以把 thefo:block-container作为fo:table-cellfrom the outer的孩子fo:table

但是,由于我完全不确定我是否理解您的要求,您能否为您正在寻找的内容做一个简单的图形说明?

此外,如果如您在代码示例中所示,fo:simple-page-master位于 any 之外xsl:template,则 XSLT 处理器将忽略它,并且不会出现在您的 FO 文件中。

根据https://www.w3.org/TR/xslt#stylesheet-element

XSLT 处理器总是可以自由地忽略此类顶级元素,并且如果它无法识别名称空间 URI,则必须忽略顶级元素而不给出错误。

于 2017-04-25T11:01:10.893 回答
0

我可以看到两个问题:

  1. 您已width="7.0in"为 fo:table 指定,因此它不适合比这更窄的列。您的列只有 3.5" 减去列之间的列间距(如果您没有另外指定,则为 12pt)。表格将流向第一个足够宽以容纳它们的正文页。

  2. template match="illustratedPartsCatalog"首先做一个应用模板。如果这会生成一个页面序列并且没有关闭它,那么call-template name="numIndex"它将尝试创建一个嵌套的页面序列并且这将不起作用。

FO 模板以</fo:layout-master-set>.

然后有两种方法可以继续:可以使用template match="node"匹配 XML 中根节点的每个子节点,也可以使用xsl:call-template命令。这为您提供了更大的灵活性,您可以构建一个模板来生成一个页面序列,该页面序列包含多个根节点的子节点。

所以你可以这样做:

<xsl:call-template name="insertIllustratedPartsCatalog"/>
<xsl:call-template name="numIndex"/>

whereinsertIllustratedPartsCatalog为部件目录numIndex创建页面序列,并为索引创建页面序列。

(如果没有看到整个 FO 模板,很难得到比这更具体的内容)。

于 2017-04-19T09:48:11.510 回答