아래 2개의 xsl파일을 참고하여, xml이 html로 변환된다.
[c8_1303.xsl]
<?xml version="1.0" encoding="euc-kr"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 외부 XSL 문서 참조 -->
<xsl:import href="c8_1302.xsl"/>
<!-- 시작 템플레이트 룰 -->
<xsl:template match="/">
<html>
<body>
<h2><font color="blue">Our Book's List</font></h2>
<table border="1" cellspacing="0" width="80%">
<tr bgcolor="#FFFF66">
<th>title</th>
<th>author</th>
<th>price</th>
</tr>
<!-- book 템플레이트 룰 적용 -->
<xsl:apply-templates select="/booklist/book"/>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
[c8_1302.xsl]
<?xml version="1.0" encoding="euc-kr"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- book 템플레이트 룰 -->
<xsl:template match="book">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
<td>
<xsl:value-of select="price"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
댓글 달기