首页 > 代码库 > XSLT工作原理
XSLT工作原理
1、XSL processing flow
An XML document and an XSL stylesheet are input to the XSL processor. Let‘s look at the steps in Figure 1 in more detail:
- Match template patterns. As the XML document content is accessed (element by element), the match attribute for each template rule is compared against that portion (element and its children) of the XML document. The XSL processor accesses the XML document from top to bottom, so the matching process is sequential.
- Determine correct template. The XSL processor selects a template rule pattern that matches the XML document. The pattern for a match attribute can be very concise, specifying the path to a particular element or a particular attribute, or more general, allowing matches to any occurrence of an element or attribute within the XML document regardless of its parentage. The determination process takes these factors into account.
- Create results for output. The XSL processor deals with the template rule. Depending upon the rule body data, the literal data, XML document content, or both may be put into the output stream or other actions can take place. A result tree is created containing the results of the rule processing. As each rule is processed, information may be added to the results tree.
- Any more templates? After checking other templates that need to be processed, the XSL processor continues processing or outputs the results tree and ends the execution.
2、微软MSXML解析器的工作机制:
3、Diagram of the basic elements and process flow of Extensible Stylesheet Language Transformations.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。