在创建数据表之前在xslt中排序

时间:2013-02-05 22:08:09

标签: sorting xslt xls

我正在尝试获取数据并放入一个表并在输出到表之前对其进行排序,当我这样做时,对第一个columun进行排序,并且列的其余部分根本没有排序。我试图按streetNuame排序,只适用于第一个表格列

<fo:table>
  <fo:table-column width="82mm"/>
  <fo:table-column width="82mm"/>
  <fo:table-column width="82mm"/>
  <fo:table-body>
    <xsl:for-each select="route/address[position() mod 3 = 1]">
      <xsl:sort select="streetName"/>
      <fo:table-row>
        <xsl:apply-templates select=". | following-sibling::*[3 > position()]"/>

        <xsl:variable name="vPos" select="position()"/>
        <xsl:variable name="vUnfilled"
        select=" 2 - count(following-sibling::*)"/>
        <xsl:if test="position() = last()">
          <xsl:for-each select="../*[not(position() > $vUnfilled)]">
            <fo:table-cell>
              <fo:block>
                <xsl:value-of select="' '"/>
              </fo:block>
            </fo:table-cell>
          </xsl:for-each>
        </xsl:if>
      </fo:table-row>
    </xsl:for-each>
  </fo:table-body>
</fo:table>

下面的XML:

    <route>
       <name>blah</name>

       <address>
          <fullStreet>blah</fullStreet>
          <streetNumber>blah</streetNumber>
          <streetName>blah</streetName>

       </address>

0 个答案:

没有答案