加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

XML 输出指定数据

(2006-03-29 20:35:38)
分类: 技术/开发(原创/转载)
 <xsl:variable name="begin" select="0"/>
 <xsl:variable name="end" select="5"/>
 <xsl:for-each select="//Row[position()>$begin and position()<$end]">
 <xsl:apply-templates/>
 </xsl:for-each>


============================
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:copyRight="http://lucky_elove.www1.dotnetplayground.com/">
<!-- 下面的三个变量可以由XML中取得,做为例子,这里直接定义了初始值 -->
<!-- 定义初始值 -->
<xsl:variable name="varStart" select="0"/>
<!-- 定义结束值 -->
<xsl:variable name="varEnd" select="35"/>
<!-- 定义循环步长 -->
<xsl:variable name="varStep" select="2"/>
<xsl:template match="/">
<xsl:call-template name="MyLoopFun">
<xsl:with-param name="varStart" select="$varStart">
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="MyLoopFun">
<xsl:param name="varStart"/>
<xsl:if test="$varStart &lt; $varEnd">
<!-- 输出格式定义 -->
<a target="_blank" href="http://lucky_elove.www1.dotnetplayground.com/?{$varStart}">
<xsl:attribute name="title"><xsl:value-of select="$varStart"/></xsl:attribute>
<xsl:value-of select="$varStart"/>
</a>
<xsl:if test="$varStart &lt; ($varEnd - $varStep)"> , </xsl:if>
<xsl:call-template name="MyLoopFun">
<xsl:with-param name="varStart">
<xsl:value-of select="$varStart + $varStep"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有