XSLT:数据从上到下,然后在页面中从左到右

时间:2014-04-22 07:34:42

标签: xml xslt-2.0

我有一个xml文件,其中包含一些数据:

<A>
  <B>
    <X>(some information)</X>
    <Y>(some information)</Y>
    <Z>(some information)</Z>
  </B>
  <B>
    <X>(some information)</X>
    <Y>(some information)</Y>
    <Z>(some information)</Z>
  </B>
  <B>
    <X>(some information)</X>
    <Y>(some information)</Y>
    <Z>(some information)</Z>
  </B>
  <B>
    <X>(some information)</X>
    <Y>(some information)</Y>
    <Z>(some information)</Z>
  </B>
 .....(multiple B tags)
</A>

我需要以PDF格式显示所有B的内容,每个页面包含基于X标签中的值排序的2x2数据。问题是 - 它必须在页面中从上到下填充,然后从左到右填充。默认情况下,一行从左到右填充。列可以先在页面中完成,然后在行中完成。

如果我错过了什么,请告诉我。 代码 - 我首先填充行(完美地工作):

<fo:table table-layout="fixed">
            <fo:table-column column-width="proportional-column-width(1)" />
            <fo:table-column column-width="proportional-column-width(1)" />
            <fo:table-body>
                <xsl:for-each select="B">
                    <xsl:sort select="X" data-type="number" order="ascending" />
                    <fo:table-cell border="solid" height="3.4in"
                        font-size="7pt">
                        <xsl:attribute name="starts-row">
                            <xsl:if test="position() mod 2 = 1">true</xsl:if>
                        </xsl:attribute>
                        <xsl:attribute name="ends-row">
                            <xsl:if test="position() mod 2 = 0">true</xsl:if>
                        </xsl:attribute>
                        <fo:block>
                            <xsl:call-template name="TEST" />
                        </fo:block>
                    </fo:table-cell>
                </xsl:for-each>
            </fo:table-body>
        </fo:table>

0 个答案:

没有答案