1
所以我給了一些東西來解決,並且我對XSLT的瞭解有限。我基本上想從我運行的模板中保留一個變量。模板中的XSLT返回變量
<xsl:template name="repeatable">
<xsl:param name="index" select="1" />
<xsl:param name="total" select="10" />
<xsl:if test="not($index = $total)">
<xsl:call-template name="repeatable">
<xsl:with-param name="index" select="$index + 1" />
</xsl:call-template>
</xsl:if>
</xsl:template>
以上是我想從中返回變量「$ total」的模板。下面的模板是我稱之爲上述模板的模板。
<xsl:template match="randomtemplate">
<xsl:call-template name="repeatable" \>
</xsl:template>
所以基本上,我只想讓「總」變量返回給我或以某種方式從randomtemplate訪問。
乾杯
恐怕這沒有任何意義。 $ total參數的值是10.它被硬編碼到樣式表中,並且它不會改變,除非* you *改變它。 – 2014-12-02 05:23:39