1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="utf-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
<!-- Form the answer sheet -->
<xsl:variable name="header">
<book>
<title><xsl:value-of select="book/title"/> Questions and Answers</title>
<xsl:copy-of select="*/chapter/questions/*"/>
<xsl:copy-of select="*/chapter/title"/>
</book>
</xsl:variable>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(self::questions)]">
<xsl:copy-of select="$header"/>
</xsl:template>
<xsl:template match="*[node() != questions]">
</xsl:template>
</xsl:stylesheet>
|