| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<xsl:stylesheet version="1.0" |
| 3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 4 |
<xsl:output method="xml" |
| 5 |
indent="yes" |
| 6 |
omit-xml-declaration="no" |
| 7 |
encoding="utf-8"/> |
| 8 |
|
| 9 |
<!-- default rule --> |
| 10 |
<xsl:template match="*" mode="include"> |
| 11 |
<xsl:copy> |
| 12 |
<xsl:copy-of select="@*"/> |
| 13 |
<xsl:apply-templates mode="include"/> |
| 14 |
</xsl:copy> |
| 15 |
</xsl:template> |
| 16 |
|
| 17 |
<!-- toplevel processing instructions and comments --> |
| 18 |
<xsl:template match="processing-instruction()|comment()" mode="include"> |
| 19 |
<xsl:copy> |
| 20 |
<xsl:copy-of select="@*"/> |
| 21 |
<xsl:apply-templates mode="include"/> |
| 22 |
</xsl:copy> |
| 23 |
</xsl:template> |
| 24 |
|
| 25 |
<!-- incorporate optional include file(s) --> |
| 26 |
<xsl:template match="image/include" mode="include"> |
| 27 |
<xsl:param name="include_file_name" select="@from"/> |
| 28 |
<xsl:choose> |
| 29 |
<xsl:when test="document($include_file_name)"> |
| 30 |
<xsl:copy-of select="document($include_file_name)/image/*"/> |
| 31 |
<xsl:apply-templates mode="include"/> |
| 32 |
</xsl:when> |
| 33 |
<xsl:otherwise> |
| 34 |
<xsl:copy-of select="."/> |
| 35 |
</xsl:otherwise> |
| 36 |
</xsl:choose> |
| 37 |
</xsl:template> |
| 38 |
|
| 39 |
</xsl:stylesheet> |