XSLT
and lt;xsl: import and elements
The XSLT and xsl:import elements are used to import the contents of one style sheet into another!
Complete XSLT element reference manual
Definitions and usages
The element is the top-level element that imports the contents of one style sheet into another.
Note: Imported
style sheets have a lower priority than exported style sheets.
Note:
The element must be the first child node of the .lt;xsl:stylesheet> or .lt;xsl:transform>
Grammar
Property
属性
|
值
|
描述
|
href
|
URI
|
必需。规定要导入的样式表的 URI。
|
Instance 1
Suppose you have a style sheet cdcatalog_ex3 .xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td><xsl:value-of select="catalog/cd/title"/></td>
<td><xsl:value-of select="catalog/cd/artist"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The second style sheet cdcatalog_import .xsl imports "cdcatalog_ex3.xsl":
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="cdcatalog_ex3.xsl"/>
<xsl:template match="/">
<xsl:apply-imports/>
</xsl:template>
</xsl:stylesheet>
Note:
This instance cannot run on Netscape 6 because Netscape 6 does not support the element of slt;xsl:apply-imports!
Complete XSLT element reference manual