惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
G
GRAHAM CLULEY
S
Securelist
P
Palo Alto Networks Blog
MongoDB | Blog
MongoDB | Blog
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
WordPress大学
WordPress大学
Project Zero
Project Zero
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
C
Cyber Attacks, Cyber Crime and Cyber Security
F
Fortinet All Blogs
博客园 - 叶小钗
B
Blog RSS Feed
C
Cisco Blogs
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
K
Kaspersky official blog
D
Docker
Latest news
Latest news
Cisco Talos Blog
Cisco Talos Blog
T
Tor Project blog
Cyberwarzone
Cyberwarzone
Security Latest
Security Latest
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
C
Check Point Blog
J
Java Code Geeks
Simon Willison's Weblog
Simon Willison's Weblog
T
Tenable Blog
Recent Announcements
Recent Announcements
T
Tailwind CSS Blog
H
Help Net Security
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
Jina AI
Jina AI
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
NISL@THU
NISL@THU
美团技术团队
腾讯CDC

博客园 - 海蓝心

业余时间折腾了个微信小程序版本的街机游戏模拟器(吾爱街机),8090后的童年回忆,欢迎大家体验 Flex Formatter (flex ide 代码格式工具) 安装Android 开发工具 (二) Android 是什么 (一) 个性化印品DIY制作软件《光影21度》(.net客户端与flex通信技术) flash 电子相册 功能强大 在线传输软件 支持断点续传 flex版 个性化数码印刷在线diy XMLHttpRequest介绍 委托学习笔记二(多播委托) 委托学习笔记一(调用委托) 委托和事件— 一个虚构的故事 ASP.NET程序中常用的三十三种代码(5) ASP.NET程序中常用的三十三种代码(6) ASP.NET程序中常用的三十三种代码(3) ASP.NET程序中常用的三十三种代码(4) ASP.NET程序中常用的三十三种代码(2) ASP.NET程序中常用的三十三种代码(1) C#有关基础知识汇集
学习XSLT的知识积累
海蓝心 · 2006-07-07 · via 博客园 - 海蓝心

xsl:apply-templates

  <xsl:apply-templates> 元素用在模版内告诉XSL处理器把所提供的节点集合匹配其他模版,其语法如下所示:

<xsl:apply-templates
select="expression"
mode
="mode">
</xsl:apply-templates>

  在节点触发某个模版的情况下, XSLT通常会假定这个模版会专注该节点的所有内容而不去处理它们。模版内的<xsl:apply-templates> 元素则告诉XSLT处理器处理节点内容,在过程中执行任何有关的模版。

  <xsl:apply-templates>默认地处理所有的最近的子节点。选择属性可以让你指定特定的派生节点进行处理。它会让Xpath表达式管理当前模版的上下文环境,模式属性则只让具有指定模式的模版被执行。

  比如,假如你对/book 和 /book/chapter都建立了模版,你打算用/book模版中的<xsl:apply-templates>来激活/book/chapter :

<xsl:template match="/book">
This book is entitled "
<xsl:value-of select="title"/>"
<xsl:apply-templates/>
</xsl:template>


<xsl:template match="/book/chapter">
This is chapter 
<xsl:number/>, entitled "<xsl:value-of select="title"/>"
</xsl:template>

<xsl:param> 元素
--------------------------------------------------------------------------------
定义与用法
<xsl:param>元素被用来声明一个局部或者全局的参数。
说明:如果声明的是一个高级(top-level)的元素那么参数是全局的,如果在一个样规中声
明那么是局部的。
如:声明一个参数
1.默认值为空
<xsl:param name = "A" />
2.在声明过程中赋值
 <

xsl:param name = "B" >111</xsl:param>
参数就像我们声明变量一样.
下面是参数赋值的用法
<xsl:with-param name = "A" >11</xsl:with-param
<xsl:with-param name = "B" >33</xsl:with-param>
或者
<xsl:with-param name = "A"  select="11" />
<xsl:with-param name = "B"  select="33"  />

例子:xslt文件
 <

xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
          <xsl:output method = "text" />

          <

xsl:template match = "/" >
               <xsl:call-template name = "print" >
                    <xsl:with-param name = "A" >11</xsl:with-param>
                    <xsl:with-param name = "B" >33</xsl:with-param>
               </xsl:call-template>
               <xsl:call-template name = "print" >
                    <xsl:with-param name = "A" >55</xsl:with-param>
               </xsl:call-template>
          </xsl:template>

          <

xsl:template name = "print" >
               <xsl:param name = "A" />
               <xsl:param name = "B" >111</xsl:param>
               <xsl:text >
      
      </xsl:text>
               <xsl:value-of select = "$A" />
               <xsl:text > + </xsl:text>
               <xsl:value-of select = "$B" />
               <xsl:text > = </xsl:text>
               <xsl:value-of select = "$A+$B" />
          </xsl:template>
     </xsl:stylesheet

    xml文件
<?xml version="1.0" encoding="UTF-8"?>
<AAA>
 <BBB>bbb </BBB>
 <CCC>ccc </CCC>
</AAA>
    输出结果
11 + 33 = 44

 55 + 111 = 166

<xsl:variable> 元素
--------------------------------------------------------------------------------
定义与用法
<xsl:variable>元素被用来声明一个局部或者全局的变量。
说明:当声明为高级(top-level)元素时,变量是全局的,当在一个template 中声明时,作
为局部变量。
说明:一旦您设置了一个变量的值,您就不能修改这个值!
提示:您可以通过增加<xsl:variable>的内容或者用select 属性来设置变量值!