Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XSL-HTML表尾动态显示到位(根据表中的行数更改)_Html_Xslt_Xslt 1.0 - Fatal编程技术网

XSL-HTML表尾动态显示到位(根据表中的行数更改)

XSL-HTML表尾动态显示到位(根据表中的行数更改),html,xslt,xslt-1.0,Html,Xslt,Xslt 1.0,我有一个嵌入了HTML标记的XSL表,从中我使用Java生成了一个PDF。我能够使用这个XSL样式表生成PDF。 在我的XSL中,我有这样一个模型: Page 1: Header Table row 1 row 2 row 3 row 4 row 5 Footer Page 2: Header Table row 6 row 7 row 8 row 9 row 10 Footer Page 3: H

我有一个嵌入了HTML标记的XSL表,从中我使用Java生成了一个PDF。我能够使用这个XSL样式表生成PDF。 在我的XSL中,我有这样一个模型:

Page 1:

Header 
 Table
    row 1
    row 2
    row 3
    row 4
    row 5
Footer

Page 2:

Header 
 Table
    row 6
    row 7
    row 8
    row 9
    row 10
Footer

Page 3:

Header 
 Table
    row 11
    row 12
    row 13
Footer
我应该有显示表行的页眉和页脚每页5。问题是,我必须将页脚显示为静态内容,而不考虑表中的行数

例如:如果表格包含5行、4行、3行、2行或1行,则页脚应位于页面底部。相反,随着表大小的变化,它会在表下动态显示

请在下面找到我的XSL样式表代码:

<xsl:copy-of select="$Header"/>

<xsl:copy-of select="$OrderRowsHeader"/>

<xsl:for-each select="orders">
    <table style=" width: 100%; height: 13mm;">

        <tr style="font-size: 10px; border: 0">
                        <td width="14mm" style="text-align: right; vertical-align: top;"><xsl:value-of select="number" /></td>
                        <td width="36mm" style=" text-align: left; vertical-align: top;"><xsl:value-of select="code" /></td>
                        <td width="47mm" style=" text-align: left; vertical-align: top;" ><xsl:value-of select="description" /></td>
                        <td width="12mm" style=" text-align: left; vertical-align: top;"><xsl:value-of select="units" /></td>
                        <td width="16mm" style=" text-align: right; vertical-align: top;"><xsl:value-of select="quantity" /></td>
        </tr>
    </table>


    <xsl:if test="(position() mod 5) = 0 and ( position() !=  last() )">

            <xsl:copy-of select="$ReportFooter" />
            <div style="page-break-before: always" />

            <xsl:copy-of select="$Header"/>

            <xsl:copy-of select="$OrderRowsHeader"/>

    </xsl:if>
</xsl:for-each>

<xsl:copy-of select="$ReportFooter" />



<xsl:variable name="ReportFooter">
    <table style="border: solid thin #c0c0c0; border-collapse: collapse; width: 100%; ">
        <tr style="border: solid thin #c0c0c0; border-collapse: collapse;">
            <td width="150mm" style="border: solid thin #c0c0c0; border-collapse: collapse; font-size: 8px;">
            </td> 
                Some Text here......
            </tr>
    </table>
</xsl:variable>

<xsl:variable name="OrderRowsHeader">
    <table style="border: solid thin #c0c0c0; border-collapse: collapse; width: 100%;">

                    <tr style="border: solid thin #c0c0c0; font-size: 9px; border-collapse: collapse;">
                        <th width="18mm" style="border: solid thin #c0c0c0; border-collapse: collapse;">Line</th>
                        <th width="45mm" style="border: solid thin #c0c0c0; border-collapse: collapse;">Product code</th>
                        <th width="63mm" style="border: solid thin #c0c0c0; border-collapse: collapse;">Description</th>
                        <th width="18mm" style="border: solid thin #c0c0c0; border-collapse: collapse;">Units</th>
                        <th width="16mm" style="border: solid thin #c0c0c0; border-collapse: collapse;">Qty</th>
                    </tr>
    </table>
</xsl:variable>

这里有些文字。。。。。。
线
产品代码
描述
单位
数量

听起来您好像遇到了样式问题。您的解决方案可以在CSS中找到。除了与页脚相关的代码外,我不会处理任何代码

<xsl:variable name="ReportFooter">
    <table style="position: absolute; bottom: 0; border: solid thin #c0c0c0; border-collapse: collapse; width: 100%; ">
        <tr style="border: solid thin #c0c0c0; border-collapse: collapse;">
        <td width="150mm" style="border: solid thin #c0c0c0; border-collapse: collapse; font-size: 8px;">
        </td> 
            Some Text here......
        </tr>
    </table>
</xsl:variable>

这里有些文字。。。。。。
我添加到表中的属性是:
position:absolute;底部:0

position:absolute
将使表格忽略页面的流动(这意味着它不会相对于其他元素流动),而
bottom
是对它离页面底部多远的度量,因此
bottom:0
将它放在父容器的底部