当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT <xsl:apply-imports> 元素
The <xsl:apply-imports> element applies a template rule from an imported style sheet.
<xsl:apply-imports>元素遵循的是导入的样式表模版规则。
Template rules in imported style sheets have lower precedence than template rules in main style sheets. The <xsl:apply-imports> is used when we want to use a template rule from the imported style sheet rather than an equivalent rule in the main style sheet.
导入样式表中的模版规则与主样式表中的模版规则相比,优先级前者比后者低。当你希望使用导入样式表中的模版规则时,你可以书写<xsl:apply-imports>标签。
<xsl:apply-imports/> |
None无
Suppose we have a style sheet called "standard.xsl" that contains a template rule for message elements:
假设我们拥有一个名为“standard.xsl”的样式表,它包含了消息元素的模版规则,具体如下:
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:template match="message"> </xsl:stylesheet> |
Another style sheet could import "standard.xsl", and modify the message elements, like this:
另外一张样式表中导入名为“standard.xsl”的样式表文件,用于修饰消息元素,具体如下:
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:import href="standard.xsl"/> <xsl:template match="message"> </xsl:stylesheet> |
The result would be to transform a message into an element of the form:
输出的结果是:将一个消息元素转换成一个表单元素:
<div style="border:solid blue"><h2>...</h2></div> |