index.xsl中包含head.xsl,bottom.xsl

index.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>
<head>
<title>index</title>
</head>
<body>
<div id="head"><xsl:copy-of select="document('head.xsl')"/></div>
<div id="mainbox"><xsl:value-of select="content"/></div>
<div id="bottom"><xsl:copy-of select="document('head.xsl')"/></div>
<div></div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

head.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="/">
Head
</xsl:template>
</xsl:stylesheet>

bottom.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="/">
Bottom
</xsl:template>
</xsl:stylesheet>


Index.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="index.xsl"?>
<content>body body body</content>

原文地址:https://www.cnblogs.com/yesun/p/476891.html