关于 XSL 的,很好拿的 50 分哦

platinum 2002-03-14 02:28:46
假设有这么个元素

<a number="5" />

我希望 xsl 在解析它的时候能生成 "1 2 3 4 5",如何做到?
...全文
44 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
platinum 2002-03-14
  • 打赏
  • 举报
回复
faint …… 没想到这么长 …… 再简练不了?
windlike 2002-03-14
  • 打赏
  • 举报
回复
高手呀,高手,得象你多多学习
oliff 2002-03-14
  • 打赏
  • 举报
回复
不好意思,少了这个
</xsl:stylesheet>
oliff 2002-03-14
  • 打赏
  • 举报
回复
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

...
...
<xsl:template match="a">
<xsl:call-template name="NumberTemplate">
<xsl:with-param name="number" select="@number"/>
<xsl:with-param name="start" select="1"/>
</xsl:call-template>
<xsl:value-of select="@number"/>
</xsl:template>
<xsl:template name="NumberTemplate">
<xsl:param name="number"/>
<xsl:param name="start"/>
<xsl:if test="$start < $number">
<xsl:variable name="next" select="$start"/>
<xsl:value-of select="$next"/><xsl:text> </xsl:text>
<xsl:call-template name="NumberTemplate">
<xsl:with-param name="number" select="$number"/>
<xsl:with-param name="start" select="$start + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

8,906

社区成员

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

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