1

xhtmlテーブルをInDesignXMLテーブルに変換するXSLT2.0があります。このXSLTは、以下のテンプレートの行7のすべての行内の要素の最大数をカウントします( )。<td><tr>max(for $td in //tr return count($td/td))

<xsl:template match="table">
    <xsl:element name="id_table">
        <xsl:attribute name="aid:trows">
            <xsl:value-of select="count(child::*/tr)"/>
        </xsl:attribute>
        <xsl:attribute name="aid:tcols">
            <xsl:value-of select="max(for $td in //tr return count($td/td))"/>
        </xsl:attribute>
        <xsl:apply-templates/>
    </xsl:element>
</xsl:template>

XSLT 1.0でこれを実現する方法がわかりません。アイデアがあれば大歓迎です!残念ながら、ワークフローパイプラインには1.0プロセッサしかありません。


<xsl:attribute name="aid:tcols">
  <xsl:for-each select="//tr">
    <xsl:sort select="count(td)" order="descending"/>
    <xsl:if test="position() = 1">
      <xsl:value-of select="count(td)"/>
    </xsl:if>
  </xsl:for-each>
</xsl:attribute>

する必要があります。

4

1 に答える 1

2
<xsl:attribute name="aid:tcols">
  <xsl:for-each select="//tr">
    <xsl:sort select="count(td)" order="descending"/>
    <xsl:if test="position() = 1">
      <xsl:value-of select="count(td)"/>
    </xsl:if>
  </xsl:for-each>
</xsl:attribute>

する必要があります。

于 2012-08-13T15:20:17.933 に答える