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 |
|
---|
16 | <xsl:template match="/">
|
---|
17 | <html>
|
---|
18 | <head>
|
---|
19 | <title><xsl:value-of select="$manifest/Title"/></title>
|
---|
20 | <style type="text/css">
|
---|
21 | h1.pagebreak {page-break-before: always}
|
---|
22 | </style>
|
---|
23 | </head>
|
---|
24 | <body>
|
---|
25 | <a name="index"/>
|
---|
26 | <h1><xsl:value-of select="$manifest/Title"/></h1>
|
---|
27 | <xsl:apply-templates select="$manifest/Section" mode="index"/>
|
---|
28 | <xsl:apply-templates select="$manifest/Section"/>
|
---|
29 |
|
---|
30 | <div style="text-align:center;"><xsl:apply-templates select="/TutorialList/SupplementaryText/Text[@id='copyright']"/></div>
|
---|
31 |
|
---|
32 | </body>
|
---|
33 | </html>
|
---|
34 | </xsl:template>
|
---|
35 |
|
---|
36 |
|
---|
37 | <xsl:template match="Section" mode="index">
|
---|
38 | <xsl:variable name="secnum" select="@number"/>
|
---|
39 | <div style="page-break-after: always;">
|
---|
40 | <h2><a href="#{@id}"><xsl:value-of select="Heading"/></a></h2>
|
---|
41 | <xsl:for-each select="TutorialRef|SplitTutorialRef">
|
---|
42 | <dl>
|
---|
43 | <xsl:variable name="id" select="@id"/>
|
---|
44 | <xsl:variable name="pos" select="position()"/>
|
---|
45 | <xsl:if test="self::TutorialRef">
|
---|
46 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]" mode="index">
|
---|
47 | <xsl:with-param name="number">
|
---|
48 | <xsl:value-of select="$pos"/>
|
---|
49 | <!--<xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/>-->
|
---|
50 | </xsl:with-param>
|
---|
51 | </xsl:apply-templates>
|
---|
52 | </xsl:if>
|
---|
53 | <xsl:if test="self::SplitTutorialRef">
|
---|
54 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]" mode="splitindex">
|
---|
55 | <xsl:with-param name="number">
|
---|
56 | <xsl:value-of select="$pos"/>
|
---|
57 | <!--<xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/>-->
|
---|
58 | </xsl:with-param>
|
---|
59 | <xsl:with-param name="split" select="@split"/>
|
---|
60 | <xsl:with-param name="type" select="@type"/>
|
---|
61 | <xsl:with-param name="current" select="@current"/>
|
---|
62 | <xsl:with-param name="titleextra" select="@titleextra"/>
|
---|
63 | </xsl:apply-templates>
|
---|
64 | </xsl:if>
|
---|
65 | </dl>
|
---|
66 | </xsl:for-each>
|
---|
67 | </div>
|
---|
68 | </xsl:template>
|
---|
69 |
|
---|
70 | <xsl:template match="Section">
|
---|
71 | <xsl:variable name="secnum" select="@number"/>
|
---|
72 | <a name="{@id}"/>
|
---|
73 | <h1 class="pagebreak"><xsl:value-of select="Heading"/></h1>
|
---|
74 | <xsl:for-each select="TutorialRef|SplitTutorialRef">
|
---|
75 | <xsl:variable name="id" select="@id"/>
|
---|
76 | <xsl:variable name="pos" select="position()"/>
|
---|
77 | <xsl:if test="self::TutorialRef">
|
---|
78 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]">
|
---|
79 | <xsl:with-param name="number">
|
---|
80 | <!-- for just one section -->
|
---|
81 | <xsl:value-of select="$pos"/>
|
---|
82 | <!-- for more than one sections -->
|
---|
83 | <!--<xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/>-->
|
---|
84 | </xsl:with-param>
|
---|
85 | </xsl:apply-templates>
|
---|
86 | </xsl:if>
|
---|
87 | <xsl:if test="self::SplitTutorialRef">
|
---|
88 | <xsl:apply-templates select="$tutorial/Tutorial[@id=$id]" mode="split">
|
---|
89 | <xsl:with-param name="number">
|
---|
90 | <xsl:value-of select="$pos"/>
|
---|
91 | <!--<xsl:value-of select="$secnum"/>.<xsl:value-of select="$pos"/>-->
|
---|
92 | </xsl:with-param>
|
---|
93 | <xsl:with-param name="split" select="@split"/>
|
---|
94 | <xsl:with-param name="type" select="@type"/>
|
---|
95 | <xsl:with-param name="current" select="@current"/>
|
---|
96 | <xsl:with-param name="titleextra" select="@titleextra"/>
|
---|
97 | <xsl:with-param name="beginnotes" select="BeginNotes"/>
|
---|
98 | <xsl:with-param name="endnotes" select="EndNotes"/>
|
---|
99 | </xsl:apply-templates>
|
---|
100 | </xsl:if>
|
---|
101 | </xsl:for-each>
|
---|
102 | </xsl:template>
|
---|
103 |
|
---|
104 | <xsl:template match="Tutorial">
|
---|
105 | <xsl:param name="number"/>
|
---|
106 | <div style="page-break-after: always;">
|
---|
107 | <h2><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/></h2>
|
---|
108 | <xsl:apply-templates select="Content/*"/>
|
---|
109 | </div>
|
---|
110 | </xsl:template>
|
---|
111 |
|
---|
112 | <xsl:template match="Tutorial" mode="index">
|
---|
113 | <xsl:param name="number"/>
|
---|
114 | <dt><b><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/></b></dt>
|
---|
115 | <dd><xsl:for-each select="Content/Heading">
|
---|
116 | <xsl:apply-templates/><br/>
|
---|
117 | </xsl:for-each>
|
---|
118 | </dd>
|
---|
119 | </xsl:template>
|
---|
120 |
|
---|
121 | <xsl:template match="Tutorial" mode="split">
|
---|
122 | <xsl:param name="number"/>
|
---|
123 | <xsl:param name="split"/>
|
---|
124 | <xsl:param name="type"/>
|
---|
125 | <xsl:param name="current"/>
|
---|
126 | <xsl:param name="titleextra"/>
|
---|
127 | <xsl:param name="beginnotes"/>
|
---|
128 | <xsl:param name="endnotes"/>
|
---|
129 |
|
---|
130 | <div style="page-break-after: always;">
|
---|
131 | <h2><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/><xsl:value-of select="$titleextra"/></h2>
|
---|
132 | <xsl:apply-templates select="$beginnotes"/>
|
---|
133 | <xsl:variable name="splitnode" select="xalan:evaluate(concat('Content/',$split))"/>
|
---|
134 | <xsl:if test="$type='preceding'">
|
---|
135 | <xsl:for-each select="$splitnode">
|
---|
136 | <xsl:apply-templates select="preceding-sibling::node()"/>
|
---|
137 | </xsl:for-each>
|
---|
138 | </xsl:if>
|
---|
139 | <xsl:if test="$current='true'">
|
---|
140 | <xsl:apply-templates select="$splitnode"/>
|
---|
141 | </xsl:if>
|
---|
142 | <xsl:if test="$type='following'">
|
---|
143 | <xsl:for-each select="$splitnode">
|
---|
144 | <xsl:apply-templates select="following-sibling::node()"/>
|
---|
145 | </xsl:for-each>
|
---|
146 | </xsl:if>
|
---|
147 | <xsl:apply-templates select="$endnotes"/>
|
---|
148 | </div>
|
---|
149 | </xsl:template>
|
---|
150 |
|
---|
151 | <xsl:template match="Tutorial" mode="splitindex">
|
---|
152 | <xsl:param name="number"/>
|
---|
153 | <xsl:param name="split"/>
|
---|
154 | <xsl:param name="type"/>
|
---|
155 | <xsl:param name="current"/>
|
---|
156 | <xsl:param name="titleextra"/>
|
---|
157 |
|
---|
158 | <dt><b><xsl:value-of select="$number"/>. <xsl:apply-templates select="Title/Text"/><xsl:value-of select="$titleextra"/></b></dt>
|
---|
159 | <dd>
|
---|
160 | <xsl:variable name="splitnode" select="xalan:evaluate(concat('Content/',$split))"/>
|
---|
161 | <xsl:if test="$type='preceding'">
|
---|
162 | <xsl:for-each select="$splitnode">
|
---|
163 | <xsl:for-each select="preceding-sibling::Heading">
|
---|
164 | <xsl:apply-templates/><br/>
|
---|
165 | </xsl:for-each>
|
---|
166 | </xsl:for-each>
|
---|
167 | </xsl:if>
|
---|
168 | <xsl:if test="$current='true'">
|
---|
169 | <xsl:for-each select="$splitnode">
|
---|
170 | <xsl:apply-templates/><br/>
|
---|
171 | </xsl:for-each>
|
---|
172 | </xsl:if>
|
---|
173 | <xsl:if test="$type='following'">
|
---|
174 | <xsl:for-each select="$splitnode">
|
---|
175 | <xsl:for-each select="following-sibling::Heading">
|
---|
176 | <xsl:apply-templates/><br/>
|
---|
177 | </xsl:for-each>
|
---|
178 | </xsl:for-each>
|
---|
179 | </xsl:if>
|
---|
180 | </dd>
|
---|
181 | </xsl:template>
|
---|
182 |
|
---|
183 | <xsl:template match="TutorialRef" priority="2">
|
---|
184 | <xsl:variable name="ref" select="@id"/>
|
---|
185 | <b><xsl:value-of select="/TutorialList/Tutorial[@id=$ref]/Title/Text"/></b>
|
---|
186 | </xsl:template>
|
---|
187 |
|
---|
188 | </xsl:stylesheet>
|
---|