zoukankan
html css js c++ java
Xslt中递归的实现
<?
xml version="1.0" encoding="gb2312"
?>
<
xsl:stylesheet
version
="1.0"
xmlns:xsl
="http://www.w3.org/1999/XSL/Transform"
xmlns:fo
="http://www.w3.org/1999/XSL/Format"
>
<
xsl:template
match
="/"
>
<!--
addFunction(addString,currentNum,theResult)
-->
<
xsl:call-template
name
="addFunction"
>
<
xsl:with-param
name
="addString"
>
1
</
xsl:with-param
>
<
xsl:with-param
name
="currentNum"
>
1
</
xsl:with-param
>
<
xsl:with-param
name
="theResult"
>
1
</
xsl:with-param
>
</
xsl:call-template
>
</
xsl:template
>
<!--
void addFunction(string addString,int currenNum,int thgeResult)
{
Console.Write(addString + "+" + currenNum.ToString() + " =");
Console.WriteLine((currenNum+thgeResult).ToString());
if (currentNum<10)
{
addFunction(addString+"+"+currentNum.ToString(),currenNum+1,thgeResult+currenNum);
}
}
-->
<
xsl:template
name
="addFunction"
>
<
xsl:param
name
="addString"
/>
<
xsl:param
name
="currentNum"
/>
<
xsl:param
name
="theResult"
/>
<
xsl:value-of
select
="concat($addString,'+',$currentNum)"
/>
=
<
xsl:value-of
select
="$theResult + $currentNum"
/>
<
br
/>
<
xsl:if
test
="$currentNum <= 10 "
>
<
xsl:call-template
name
="addFunction"
>
<
xsl:with-param
name
="addString"
select
="concat($addString,'+',$currentNum)"
/>
<
xsl:with-param
name
="currentNum"
select
="$currentNum + 1"
/>
<
xsl:with-param
name
="theResult"
select
="$theResult + $currentNum"
/>
</
xsl:call-template
>
</
xsl:if
>
</
xsl:template
>
</
xsl:stylesheet
>
查看全文
相关阅读:
主攻ASP.NET MVC4.0之重生:Asp.Net MVC WebApi OData
跨平台移动开发 Android使用JPush推送消息
跨平台移动开发 手机上使用Iscroll.Js的Banner
主攻ASP.NET MVC4.0之重生:MVC Controller修改Controller.tt模版,自动添加版本注释信息
正则表达式 获取字符串内提取图片URL字符串
学习C#之旅 冒泡排序,选择排序,插入排序,希尔排序[资料收集]
主攻ASP.NET MVC4.0之重生:使用反射获取Controller的ActionResult
跨平台移动开发_PhoneGap 使用Accelerometer 加速器
跨平台移动开发_PhoneGap 使用Geolocation基于所在地理位置坐标调用百度地图API
跨平台移动开发_PhoneGap 警告,通知,鸣叫,振动4 种通知类型
原文地址:https://www.cnblogs.com/goodspeed/p/208965.html
最新文章
Android写入文件操作权限
Android手势操作
Android视频录制
Android全屏显示
查看sql语句执行时间/测试sql语句性能
SQL Server 删除表的默认值约束
SQL Server查看表的约束
SQL比较两表字段和字段类型
VS2015提示:未安装Style的Visual Studio语言支持,代码编辑Intellisense将不可用。服务器控件的标记Intellisense可能不起作用
PyCharm安装
热门文章
Windows系统下Python环境的搭建
SQL Prompt 格式化SQL会自动插入分号的问题
VS2015安装SVN插件
打开VS2015提示“重新启动处于挂起状态。请在启动Visual Studio”之前重新启动
CS193p Lecture 4
Python 命令
在Xcode中编辑运行 Python 脚本
NSDate
NSRange
Ukulele 调音
Copyright © 2011-2022 走看看