xslt的处理流程是怎样的

yoken 2003-10-30 08:29:33
<?xml version="1.0"?>
<authors>
<author id="0">
<name lang="Eng">Mike Galos</name>
<nationality>French</nationality>
</author>
<author id="1" period="modern">
aaa
<name>Eva Corets</name>
<nationality>British</nationality>
</author>
<author id="2" period="modern">
<name>Cynthia Randall</name>
<nationality>Canadian</nationality>
</author>
<author id="3">
<name>Stefan Knorr</name>
<nationality>Canadian</nationality>
</author>
<author id="4" period="contemporary">
<name>Paula Thurman</name>
<nationality>British</nationality>
</author>
</authors>




<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="authors/author/name"/>
</xsl:template>
<xsl:template match="name">
<xsl:copy><xsl:value-of select="."/></xsl:copy>
</xsl:template>
</xsl:stylesheet>



用那个xsl文件处理那个xml文件的过程是怎样的,比如xml文件中各element的处理顺序,xsl文件里各template的执行顺序,该xsl文件里是否就那两个template起作用,built-in template rules是不是就不起作用了

msxml sdk里说的好像不清:
When the XSLT processor begins to process the XSLT tree, the processor looks for the template rule that points to the document root element in the source tree.
At its simplest, the template rule that points to this root element is as follows:
<xsl:template match="/firstelement">
Here the value of the match pattern indicates that this rule applies to the first element (represented by firstelement) of the root node (represented by the slash, /). In the Sample XML File (books.xml), the simplest template rule that points to the document root element is the following:
<xsl:template match="/catalog">
After the XSLT processor locates this initial template rule, the rocessor evaluates the rule and proceeds as follows:
If the rule has no conditional statements, it most likely directs the processor to simply transform this document root element. In this case, the processor transforms the root element and then looks for a template rule that matches the next highest element in the source tree. The processor transforms that element, and then looks for the next highest
element. This process continues for all the elements in the source tree.
If the rule contains conditional statements, the processor evaluates each statement and executes the appropriate action. Often, each conditional statement directs the XSLT processor through a series of template rules that are specific to the conditional statement.

Essentially, this means that the XSLT processor ignores all template rules associated with other conditional statements.

这里highest指什么,是位置最靠前的意思吗,


...全文
68 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yoken 2003-10-30
  • 打赏
  • 举报
回复
搞定了,还是http://www.w3.org/TR/xslt说的清楚
saucer 2003-10-30
  • 打赏
  • 举报
回复
the explanations seem very clear to me

>>>next highest element

大意是指靠近根节点的下一个节点


>>>用那个xsl文件处理那个xml文件的过程是怎样

but see

XSLT Rules
http://www.2000trainers.com/article.aspx?articleID=273&page=1

8,906

社区成员

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

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