我需要生成一个链接列表,作为最大值,我想要做的是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