XSLT <xsl:가져오기>
❮ 완전한 XSLT 요소 참조
정의 및 사용
<xsl:import> 요소는 한 스타일 시트의 내용을 다른 스타일 시트로 가져오는 데 사용되는 최상위 요소입니다.
참고: 가져온 스타일 목록은 가져오는 스타일 목록보다 우선 순위가 낮습니다.
참고: 이 요소는 <xsl:stylesheet> 또는 <xsl:transform>의 첫 번째 자식 노드로 나타나야 합니다.
통사론
<xsl:import href="URI"/>
속성
Attribute | Value | Description |
---|---|---|
href | URI | Required. Specifies the URI of the style sheet to import |
실시예 1
"cdcatalog_ex3.xsl"이라는 스타일 시트가 있다고 가정합니다.
<?xml version="1.0" encoding="UTF-8"?>
<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>
"cdcatalog_import.xsl"이라는 두 번째 스타일 시트는 "cdcatalog_ex3.xsl"을 가져옵니다.
<?xml version="1.0" encoding="UTF-8"?>
<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>
❮ 완전한 XSLT 요소 참조