【发布时间】:2016-03-03 03:11:46
【问题描述】:
这是我的 XSLT:
<xsl:choose>
<xsl:when test="string-length(/*/location/name)">
<xsl:variable name="pagurl">/location/<xsl:value-of select="/*/location/@id" />comments</xsl:variable>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="pagurl">/state/<xsl:value-of select="/*/state/@code" />/comments</xsl:variable>
</xsl:otherwise>
</xsl:choose>
<div class="pagination_outer" id="pager">
<xsl:call-template name="pagination">
<xsl:with-param name="url"><xsl:value-of select="$pagurl"/></xsl:with-param>
</xsl:call-template>
</div>
我正在做以下事情:
- 将变量
$pagurl分配给基于字符串长度的值。 - 试图在调用
<xsl:with-param name="url"><xsl:value-of select="$pagurl"/></xsl:with-param>中使用变量
当我包含这个调用时,页面似乎永远不会完成加载,但是当我不使用它时,页面加载得很好。 我想我的用法有误。
我认为没有必要查看pagination template,因为如果我硬编码一个值,它就可以正常工作。
建议?
【问题讨论】:
-
看起来你想execute dynamic XPath?
-
@har07,不,没什么复杂的——只是一个scoping issue。