1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <xsl:stylesheet version="1.0"
|
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | xmlns:xalan="http://xml.apache.org/xalan">
|
---|
5 |
|
---|
6 | <xsl:param name="gs-major-version"/>
|
---|
7 | <xsl:include href="common.xsl"/>
|
---|
8 |
|
---|
9 | <xsl:output method="html"/>
|
---|
10 | <!-- set mode to cd/web/wiki depending on where the files will end up -->
|
---|
11 | <xsl:variable name="mode">cd</xsl:variable>
|
---|
12 |
|
---|
13 | <xsl:variable name="manifest" select="document('manifest.xml')/Manifest"/>
|
---|
14 | <xsl:variable name="tutorial" select="/TutorialList"/>
|
---|
15 | <xsl:template match="/">
|
---|
16 | <xsl:call-template name="Index"/>
|
---|
17 | <xsl:apply-templates select="$manifest/Section"/>
|
---|
18 | </xsl:template>
|
---|
19 |
|
---|
20 | <xsl:template name="Index">
|
---|
21 | <html>
|
---|
22 | <head>
|
---|
23 | <title><xsl:value-of select="$manifest/Title"/></title>
|
---|
24 | </head>
|
---|
25 | <body>
|
---|
26 | <a name="index"/>
|
---|
27 | <h1><xsl:value-of select="$manifest/Title"/></h1>
|
---|
28 | <xsl:apply-templates select="$manifest/Section" mode="index"/>
|
---|
29 | </body>
|
---|
30 | </html>
|
---|
31 | </xsl:template>
|
---|
32 |
|
---|
33 | <xsl:template match="Section" mode="index">
|
---|
34 | <xsl:variable name="secnum" select="@number"/>
|
---|
35 | <h2><a href="{@id}.htm"><xsl:value-of select="Heading"/></a></h2>
|
---|
36 | <xsl:for-each select="TutorialRef|SplitTutorialRef">
|
---|
37 | <dl>
|
---|
38 | <xsl:variable name="id" select="@id"/>
|
---|
39 | <xsl:variable name="pos" select="position()"/>
|
---|
40 | <xsl:if test="self::TutorialRef">
|
---|
41 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]" mode="index">
|
---|
42 | <xsl:with-param name="number"><xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/></xsl:with-param>
|
---|
43 | </xsl:apply-templates>
|
---|
44 | </xsl:if>
|
---|
45 | <xsl:if test="self::SplitTutorialRef">
|
---|
46 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]" mode="splitindex">
|
---|
47 | <xsl:with-param name="number"><xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/></xsl:with-param>
|
---|
48 | <xsl:with-param name="split" select="@split"/>
|
---|
49 | <xsl:with-param name="type" select="@type"/>
|
---|
50 | <xsl:with-param name="current" select="@current"/>
|
---|
51 | <xsl:with-param name="titleextra" select="@titleextra"/>
|
---|
52 | </xsl:apply-templates>
|
---|
53 | </xsl:if>
|
---|
54 | </dl>
|
---|
55 | </xsl:for-each>
|
---|
56 | </xsl:template>
|
---|
57 |
|
---|
58 | <xsl:template match="Section">
|
---|
59 | <xsl:variable name="secnum" select="@number"/>
|
---|
60 | <html>
|
---|
61 | <head>
|
---|
62 | <title><xsl:value-of select="Heading"/></title>
|
---|
63 | </head>
|
---|
64 | <body>
|
---|
65 | <a name="{@id}"/>
|
---|
66 | <h1><xsl:value-of select="Heading"/></h1>
|
---|
67 | <xsl:for-each select="TutorialRef|SplitTutorialRef">
|
---|
68 | <xsl:variable name="id" select="@id"/>
|
---|
69 | <xsl:variable name="pos" select="position()"/>
|
---|
70 | <xsl:if test="self::TutorialRef">
|
---|
71 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]">
|
---|
72 | <xsl:with-param name="number"><xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/></xsl:with-param>
|
---|
73 | </xsl:apply-templates>
|
---|
74 | </xsl:if>
|
---|
75 | <xsl:if test="self::SplitTutorialRef">
|
---|
76 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]" mode="split">
|
---|
77 | <xsl:with-param name="number"><xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/></xsl:with-param>
|
---|
78 | <xsl:with-param name="split" select="@split"/>
|
---|
79 | <xsl:with-param name="type" select="@type"/>
|
---|
80 | <xsl:with-param name="current" select="@current"/>
|
---|
81 | <xsl:with-param name="titleextra" select="@titleextra"/>
|
---|
82 | <xsl:with-param name="beginnotes" select="BeginNotes"/>
|
---|
83 | <xsl:with-param name="endnotes" select="EndNotes"/>
|
---|
84 | </xsl:apply-templates>
|
---|
85 | </xsl:if>
|
---|
86 | </xsl:for-each>
|
---|
87 | </body>
|
---|
88 | </html>
|
---|
89 | </xsl:template>
|
---|
90 |
|
---|
91 | <xsl:template match="Tutorial">
|
---|
92 | <xsl:param name="number"/>
|
---|
93 | <h2><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/></h2>
|
---|
94 | <xsl:apply-templates select="Content/*"/>
|
---|
95 | </xsl:template>
|
---|
96 |
|
---|
97 | <xsl:template match="Tutorial" mode="index">
|
---|
98 | <xsl:param name="number"/>
|
---|
99 | <dt><b><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/></b></dt>
|
---|
100 | <dd><xsl:for-each select="Content/Heading">
|
---|
101 | <xsl:apply-templates/><br/>
|
---|
102 | </xsl:for-each>
|
---|
103 | </dd>
|
---|
104 | </xsl:template>
|
---|
105 |
|
---|
106 | <xsl:template match="Tutorial" mode="split">
|
---|
107 | <xsl:param name="number"/>
|
---|
108 | <xsl:param name="split"/>
|
---|
109 | <xsl:param name="type"/>
|
---|
110 | <xsl:param name="current"/>
|
---|
111 | <xsl:param name="titleextra"/>
|
---|
112 | <xsl:param name="beginnotes"/>
|
---|
113 | <xsl:param name="endnotes"/>
|
---|
114 | <h2><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/><xsl:value-of select="$titleextra"/></h2>
|
---|
115 | <xsl:apply-templates select="$beginnotes"/>
|
---|
116 | <xsl:variable name="splitnode" select="xalan:evaluate(concat('Content/',$split))"/>
|
---|
117 | <xsl:if test="$type='preceding'">
|
---|
118 | <xsl:for-each select="$splitnode">
|
---|
119 | <xsl:apply-templates select="preceding-sibling::node()"/>
|
---|
120 | </xsl:for-each>
|
---|
121 | </xsl:if>
|
---|
122 | <xsl:if test="$current='true'">
|
---|
123 | <xsl:apply-templates select="$splitnode"/>
|
---|
124 | </xsl:if>
|
---|
125 | <xsl:if test="$type='following'">
|
---|
126 | <xsl:for-each select="$splitnode">
|
---|
127 | <xsl:apply-templates select="following-sibling::node()"/>
|
---|
128 | </xsl:for-each>
|
---|
129 | </xsl:if>
|
---|
130 | <xsl:apply-templates select="$endnotes"/>
|
---|
131 | </xsl:template>
|
---|
132 |
|
---|
133 | <xsl:template match="Tutorial" mode="splitindex">
|
---|
134 | <xsl:param name="number"/>
|
---|
135 | <xsl:param name="split"/>
|
---|
136 | <xsl:param name="type"/>
|
---|
137 | <xsl:param name="current"/>
|
---|
138 | <xsl:param name="titleextra"/>
|
---|
139 |
|
---|
140 | <dt><b><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/><xsl:value-of select="$titleextra"/></b></dt>
|
---|
141 | <dd>
|
---|
142 | <xsl:variable name="splitnode" select="xalan:evaluate(concat('Content/',$split))"/>
|
---|
143 | <xsl:if test="$type='preceding'">
|
---|
144 | <xsl:for-each select="$splitnode">
|
---|
145 | <xsl:for-each select="preceding-sibling::Heading">
|
---|
146 | <xsl:apply-templates/><br/>
|
---|
147 | </xsl:for-each>
|
---|
148 | </xsl:for-each>
|
---|
149 | </xsl:if>
|
---|
150 | <xsl:if test="$current='true'">
|
---|
151 | <xsl:for-each select="$splitnode">
|
---|
152 | <xsl:apply-templates/><br/>
|
---|
153 | </xsl:for-each>
|
---|
154 | </xsl:if>
|
---|
155 | <xsl:if test="$type='following'">
|
---|
156 | <xsl:for-each select="$splitnode">
|
---|
157 | <xsl:for-each select="following-sibling::Heading">
|
---|
158 | <xsl:apply-templates/><br/>
|
---|
159 | </xsl:for-each>
|
---|
160 | </xsl:for-each>
|
---|
161 | </xsl:if>
|
---|
162 | </dd>
|
---|
163 | </xsl:template>
|
---|
164 |
|
---|
165 | <xsl:template match="TutorialRef" priority="2">
|
---|
166 | <xsl:variable name="ref" select="@id"/>
|
---|
167 | <b><xsl:value-of select="/TutorialList/Tutorial[@id=$ref]/Title/Text"/></b>
|
---|
168 | </xsl:template>
|
---|
169 |
|
---|
170 | </xsl:stylesheet>
|
---|