source: trunk/gsdl-documentation/manuals/processing/common.xsl@ 13785

Last change on this file since 13785 was 13785, checked in by lh92, 17 years ago

changed to display the navigation links

  • Property svn:keywords set to Author Date Id Revision
File size: 9.7 KB
Line 
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 xmlns:java="http://xml.apache.org/xalan/java"
5 xmlns:util="ExternalRef" extension-element-prefixes="util">
6
7 <xsl:template match="Title"><p><b><i><xsl:apply-templates/></i></b></p></xsl:template>
8
9 <xsl:template match="Title" mode="Figure">
10 <xsl:param name="no"/>
11 <div style="margin-right:1.7pt;" align="center"><b>Figure&#160;<xsl:value-of select="$no"/>
12 <xsl:if test="SubTitle"><xsl:value-of select="SubTitle"/></xsl:if>&#160;
13 <xsl:apply-templates select="Text"/></b>
14 </div>
15 </xsl:template>
16
17 <xsl:template match="Title" mode="Table">
18 <div style="margin-right:1.7pt;" align="center">
19 <b>Table&#160;<xsl:number count="Table[not(@class='hidden')]" level="any"/>&#160;<xsl:apply-templates/></b></div>
20 </xsl:template>
21
22 <xsl:template match="NumberedList"><ol><xsl:apply-templates/></ol></xsl:template>
23 <xsl:template match="NumberedItem"><li><xsl:apply-templates/></li></xsl:template>
24
25 <xsl:template match="BulletList">
26 <xsl:if test="not(parent::Bullet)">
27 <ul style="list-style-type: disc;">
28 <xsl:for-each select="Bullet">
29 <li><xsl:apply-templates/></li>
30 <xsl:if test="BulletList">
31 <xsl:for-each select="BulletList">
32 <ul style="list-style-type: disc;"><xsl:for-each select="Bullet"><li><xsl:apply-templates/></li></xsl:for-each></ul>
33 </xsl:for-each>
34 </xsl:if>
35 </xsl:for-each>
36 </ul>
37 <p/>
38 </xsl:if>
39 </xsl:template>
40
41 <xsl:template match="Text">
42 <xsl:choose>
43 <xsl:when test="parent::Indented">
44 <p style="font-size=12px; color=black; text-align=justify; margin-left=15pt;"><xsl:apply-templates/></p>
45 </xsl:when>
46 <xsl:when test="parent::Title|parent::Footnote"><xsl:apply-templates/></xsl:when>
47 <xsl:when test="not(parent::Version) and not(parent::Date) and not(parent::NumberedItem) and not(parent::Bullet)">
48 <p><xsl:apply-templates/></p>
49 </xsl:when>
50 <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
51 </xsl:choose>
52 </xsl:template>
53
54 <xsl:template match="CodeLine">
55 <xsl:choose>
56 <xsl:when test="parent::Figure or parent::th">
57 <div style="margin-top:0pt; margin-right:0in; margin-bottom:0in; margin-left:2pt; margin-bottom:0pt;
58 font-family: Courier; font-size: 11px"><xsl:apply-templates/></div>
59 </xsl:when>
60 <xsl:when test="name(preceding-sibling::*[position()=1])='CodeLine' or name(following-sibling::*[position()=1])='CodeLine'">
61
62 <div style="margin-top:0pt; margin-right:0pt; margin-bottom:0pt; margin-left:2em; font-size:10px; font-family:Courier;"><xsl:apply-templates/></div>
63
64 </xsl:when>
65 <!-- a single line of code between two text paragraphs -->
66 <xsl:otherwise>
67 <p><div style="font-size:10px; margin-right:0pt; margin-left:2em; margin-bottom:2px; margin-top:2px; font-family:Courier;">
68 <xsl:apply-templates/></div></p>
69 </xsl:otherwise>
70 </xsl:choose>
71 </xsl:template>
72
73 <xsl:template match="Figure">
74 <a id="Figure_{@id}"/>
75 <!-- number of current figure = total_number_of_previous_figure - total_number_of_previous_sub_figures-->
76 <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>
77 <xsl:variable name="temp_num_of_sub_figs">
78 <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
79 </xsl:variable>
80 <xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
81 <p/>
82 <xsl:apply-templates select="Title" mode="Figure"><xsl:with-param name="no" select="$no"/></xsl:apply-templates>
83 <xsl:choose>
84 <xsl:when test="CodeLine">
85 <table class="figure_code" align="center">
86 <xsl:for-each select="*[not(name()='Title')]">
87 <tr>
88 <xsl:if test="parent::Figure[@class='withLineNumber']">
89 <td><div style="linenumber"><xsl:number value="position()" format="1"/>&#160;&#160;</div></td></xsl:if>
90 <td><xsl:apply-templates select="."/></td></tr>
91 </xsl:for-each>
92 </table>
93 </xsl:when>
94 <xsl:when test="File"><div align="center"><xsl:apply-templates select="File"/></div><br/>
95 </xsl:when>
96 </xsl:choose>
97 <br/>
98 </xsl:template>
99
100 <xsl:template match="Table">
101 <p/>
102 <a id="Table_{@id}"/>
103 <xsl:if test="not(@class='hidden') and not(normalize-space(Title/Text)='')"><xsl:apply-templates select="Title" mode="Table"/></xsl:if>
104 <table cellpadding="2pt" cellspacing="2pt">
105 <xsl:if test="not(@class='hidden')">
106 <xsl:if test="not(../../@class='hidden')"><xsl:attribute name="style">border-collapse:collapse;border:1px solid black;</xsl:attribute></xsl:if>
107 <xsl:attribute name="rules">rows</xsl:attribute><xsl:attribute name="align">center</xsl:attribute>
108 </xsl:if>
109 <xsl:if test="@class='hidden'"><xsl:attribute name="width">90%</xsl:attribute><xsl:attribute name="align">center</xsl:attribute></xsl:if>
110 <xsl:for-each select="TableContent/tr">
111 <tr>
112 <xsl:if test="not(../../@class='hidden')"><xsl:attribute name="style">border-collapse:collapse;border:1px solid black;</xsl:attribute></xsl:if>
113 <xsl:for-each select="th"><td valign="top"><xsl:if test="File"><xsl:attribute name="align">right</xsl:attribute></xsl:if>
114 <xsl:apply-templates select="node()"/></td></xsl:for-each>
115 </tr>
116 </xsl:for-each>
117 </table>
118 <br/>
119 </xsl:template>
120
121 <xsl:template match="Section">
122 <a name="Section_{@id}"/>
123 <h3><xsl:if test="not(starts-with(../../@id, 'appendix'))">
124 <xsl:number level="multiple" format="1.1" count="//Chapter|//Chapter//Section"/>&#160;</xsl:if>
125 <xsl:apply-templates select="Title/Text"/></h3>
126 <xsl:apply-templates select="Content/*"/>
127 </xsl:template>
128
129 <xsl:template match="Section" mode="preface">
130 <h3><xsl:apply-templates select="Title/Text"/></h3>
131 <xsl:apply-templates select="Content/*"/>
132 </xsl:template>
133
134 <xsl:template match="Subsection">
135 <a name="Subsection_{@id}"/>
136 <h4><xsl:apply-templates select="Title/Text"/></h4>
137 <xsl:apply-templates select="Content/*"/>
138 </xsl:template>
139
140 <xsl:template match="Part"><a id="Part_{@id}"/><xsl:apply-templates/></xsl:template>
141
142 <xsl:template match="Comment"><xsl:apply-templates/></xsl:template>
143 <xsl:template match="Indented"><p><div style="margin-left: 1em;"><xsl:apply-templates/></div></p></xsl:template>
144 <xsl:template match="img|table|br|td|tr|th">
145 <xsl:copy><xsl:for-each select="@*"><xsl:copy/></xsl:for-each><xsl:apply-templates/></xsl:copy>
146 </xsl:template>
147 <xsl:template match="i|b|u"><xsl:element name="{name()}"><xsl:apply-templates/></xsl:element></xsl:template>
148 <xsl:template match="File"><a href="{@url}" target="_blank"><img src="../{@url}" width="{@width}" height="{@height}" border="0"/></a></xsl:template>
149
150
151
152 <xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
153
154 <xsl:template match="Author"><b><xsl:apply-templates/></b></xsl:template>
155 <xsl:template match="Affiliation"><i><xsl:apply-templates/></i></xsl:template>
156 <xsl:template name="version_and_date"><p><b><xsl:apply-templates select="Version/Text"/></b>&#160;&#160;<xsl:apply-templates select="Date/Text"/></p></xsl:template>
157
158 <xsl:template match="Chapter|Appendix|Bibliography" mode="index">
159 <dt><a href="#Chapter_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt>
160 <xsl:for-each select="Content/Section"><dd><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dd></xsl:for-each>
161</xsl:template>
162
163 <xsl:template match="Section" mode="index">
164 <dt><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt>
165 </xsl:template>
166
167<xsl:template match="Chapter">
168 <a id="Chapter_{@id}"/>
169 <h2><xsl:if test="not(starts-with(@id, 'appendix')) and not(starts-with(@id, 'biblio'))">
170 <xsl:value-of select="position()"/></xsl:if>&#160;<xsl:apply-templates select="Title/Text"/></h2>
171 <xsl:apply-templates select="Content/*"/>
172</xsl:template>
173
174
175
176<xsl:template match="Figure" mode="ref">
177 <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>
178 <xsl:variable name="temp_num_of_sub_figs">
179 <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
180 </xsl:variable>
181 <xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
182 <xsl:variable name="subtitle">
183 <xsl:if test="Title/SubTitle"><xsl:value-of select="substring-before(substring-after(Title/SubTitle, '('), ')')"/></xsl:if>
184 </xsl:variable>
185 <xsl:value-of select="concat($no, $subtitle)"/>
186 </xsl:template>
187 <xsl:template match="Table" mode="ref"><xsl:number level="any"/></xsl:template>
188 <xsl:template match="Chapter" mode="ref"><xsl:number level="any"/></xsl:template>
189 <xsl:template match="Section" mode="ref"><xsl:number count="//Chapter|//Chapter//Section" format="1.1" level="multiple"/></xsl:template>
190 <xsl:template match="Subsection" mode="ref"><xsl:number level="multiple" format="1.1.1" count="//Chapter|//Chapter//Section|//Chapter//Section//Subsection"/></xsl:template>
191
192
193 <xsl:template match="SupplementaryText">
194 <xsl:param name="manual_id" select="''"/>
195 <xsl:param name="manual_lang" select="''"/>
196 <xsl:for-each select="Text">
197 <div class="indexlink"><a class="indexlink">
198 <xsl:if test="@id='manual_index'"><xsl:attribute name="href"><xsl:value-of select="$manual_id"/>_<xsl:value-of select="$manual_lang"/>_index.html</xsl:attribute></xsl:if>
199 <xsl:if test="@id='top_index'"><xsl:attribute name="href">../../index.html</xsl:attribute></xsl:if>
200 <xsl:value-of select="."/></a></div>
201 </xsl:for-each>
202 </xsl:template>
203
204</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.