5,我想根据A内的值(这里是5,但也可能是6,7...),做一个循环,生成5个

peppi 2002-10-22 09:14:58
比如:
<a>5</a>
我想根据A内的值,做一个循环,生成5个<BR>

XSL中好象没有程序语言中的
for(int i = 0; i < 5; i++)
{
out.println("<BR>");
}

这种类似的方法吧?我想知道是不是只能用DOM实现呢?
...全文
69 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2002-10-26
  • 打赏
  • 举报
回复
it requires XSLT(http://www.w3.org/1999/XSL/Transform), upgrade to IE6 or install MSXML3 in replace mode

document('')//namespace::*
gives you all the namespace nodes in the current xslt stylesheet document, if not enough, try

<a>6</a>


<xsl:template match="a">
<xsl:for-each select="(document('')//namespace::* | document('')//*)[position() <= current()]">
<br />
</xsl:for-each>
</xsl:template>
peppi 2002-10-26
  • 打赏
  • 举报
回复
saucer(思归):
我用了您的方法,但不管我<a>6</a>的A内写什么值,生成的都只有三个<BR/>,还有,能不能解释解释document('')//namespace::*它是什么意思啊?是不是说当前文档的所有名称空间,但和后面的position也对不上啊,不理解为什么要一起用.呵呵
babystudio 2002-10-23
  • 打赏
  • 举报
回复
用javascript嵌入比较方便
<script>
function xunhuan(x)
{
for(var i=0;i<x;i++)
alert(i);
}
</script>

<script>xunhuan(<xsl:value-of select="a"/>);</script>
superhasty 2002-10-22
  • 打赏
  • 举报
回复
XSL可以用CDATA嵌入JAVASCRIPT呀!
saucer 2002-10-22
  • 打赏
  • 举报
回复
if you are using XSLT(http://www.w3.org/1999/XSL/Transform), and you know that the value of "a" is not too large, try

<xsl:template match="a">
<xsl:for-each select="(document('')//namespace::*)[position() <= current()]">
<br />
</xsl:for-each>
</xsl:template>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧