我需要生成一個鏈接列表,作爲最大值,我想要做的是paginator。paginator列表鏈接
例如:此變量提取最大鏈接數。
<xsl:variable name="countPages"
select="substring-after(substring-before(
//x:div[@class='navBarBottomText']/x:span, ')'), 'till ')" />
這種情況是:,該值是總的鏈路。
文件XSLT:
<xsl:template match="//x:div[@class='navBarBottomText']" >
<xsl:call-template name="paginator"/>
</xsl:template>
<xsl:template name="paginator">
<xsl:param name="pos" select="number(0)"/>
<xsl:choose>
<xsl:when test="not($pos >= countPages)">
<link href="{concat('localhost/link=' + $pos)}" />
<xsl:call-template name="paginator">
<xsl:with-param name="pos" select="$pos + 1" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
結果應該是這樣的:
<link href="localhost/link=0" />
<link href="localhost/link=1" />
<link href="localhost/link=2" />
<link href="localhost/link=3" />
<link href="localhost/link=4" />
<link href="localhost/link=5" />
<link href="localhost/link=6" />
.....
缺少一些參數?謝謝。
什麼是您目前的結果是什麼樣子? paginator模板在哪裏被調用? – JLRishe 2013-03-24 13:23:58
對不起,我編輯帖子,結果是'頁面白色',錯誤:模板'paginator'未在此樣式表中定義。 – 2013-03-24 14:35:47
AntonMM,請問編輯問題並提供應該在其上執行轉換的源XML文檔? – 2013-03-24 15:01:43