以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  关于XSLT的小问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=22037)


--  作者:smsmdsm
--  发布时间:9/8/2005 10:44:00 AM

--  关于XSLT的小问题
小弟现在正在学习有关XSLT的知识,其中有一个问题不是很清楚。
为什么有的时候<xsl:template match="*">中有<xsl:apply-templates/>而有的却没有呢?
还有,<xsl:apply-templates select="*"/>具体是什么作用呢?我只是知道这个标签是调用模板的。求各位高手。感激不尽!
--  作者:VegenaShark
--  发布时间:9/8/2005 12:13:00 PM

--  
<xsl:template match="*">定义了一个模版,并且对于源文件中的每一个节点都应用此模版
<xsl:apply-templates select="*"/>表示在当前的上下文环境中的每一个字节点都会应用模版,而应用的模版会在后面定义的模版中去找。
--  作者:qjqyx
--  发布时间:9/23/2005 5:23:00 PM

--  
首先你得明白<xsl:apply-templates select="xxx"/>是什么意思,就是对xxx这个element应用已经定义好的template (i.e: <xsl:template match = "xxx">), 如果这个template没有定义,就会找默认template(<xsl:template match="*">),如果连着个也没有定义,就不用做任何东西.

<xsl:ply-templates select = "*">就是对当前element下的所有element都调用template(<xsl:template match = "*").


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms