XML/XSLT stylesheet/include
include another xsl style sheet
File: Data.xml
File: Transform.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:include href="inlines.xsl" />
<xsl:template match="chapter">
<html>
<xsl:apply-templates />
</html>
</xsl:template>
<xsl:template match="para">
<p>
<xsl:apply-templates />
</p>
</xsl:template>
<xsl:template match="chapter/title">
<h1>
<xsl:apply-templates />
</h1>
</xsl:template>
</xsl:stylesheet>
File: inlines.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="emphasis">
<b>
<xsl:apply-templates />
</b>
</xsl:template>
<xsl:template match="literal">
<tt>
<xsl:apply-templates />
</tt>
</xsl:template>
</xsl:stylesheet>
include another xslt
File: Data.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Books.xsl"?>
<Books xmlns="http://www.wbex.ru"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Book xmlns="http://www.wbex.ru">
<Title>title 1</Title>
<Author>author 1</Author>
<Date>1998</Date>
<ISBN>1-11111-111-1</ISBN>
<Publisher>publisher 1</Publisher>
</Book>
<Book xmlns="http://www.wbex.ru">
<Title>title 2</Title>
<Author>author 2</Author>
<Date>1977</Date>
<ISBN>2-222-22222-2</ISBN>
<Publisher>publisher 2</Publisher>
</Book>
<Book xmlns="http://www.wbex.ru">
<Title>The First and Last Freedom</Title>
<Author>J. Krishnamurti</Author>
<Date>1954</Date>
<ISBN>2-33-22222-2</ISBN>
<Publisher>publisher 3</Publisher>
</Book>
</Books>
File: Books.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink/namespace"
xmlns:bks="http://www.wbex.ru"
xmlns:bk="http://www.wbex.ru"
exclude-result-prefixes="bk bks"
version="1.0">
<xsl:output method="html"/>
<xsl:include href="Book.xsl"/>
<xsl:template match="/">
<HTML>
<BODY>
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="bks:Books">
<CENTER><H2>My Bookstore</H2></CENTER>
<TABLE border="1">
<xsl:apply-templates/>
</TABLE>
</xsl:template>
<xsl:template match="bks:Book">
<xsl:variable name="book-url" select="document(@xlink:href)"/>
<xsl:apply-templates select="$book-url//bk:Book"/>
</xsl:template>
</xsl:stylesheet>
File: Book.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bk="http://www.wbex.ru"
exclude-result-prefixes="bk"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE border="1">
<xsl:apply-templates/>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="bk:Book">
<TR>
<xsl:apply-templates/>
</TR>
</xsl:template>
<xsl:template match="*">
<TD>
<xsl:value-of select="."/>
</TD>
</xsl:template>
</xsl:stylesheet>