[13632] | 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 |
|
---|
[17494] | 7 | <!-- Various Title templates -->
|
---|
[13632] | 8 | <xsl:template match="Title"><p><b><i><xsl:apply-templates/></i></b></p></xsl:template>
|
---|
[17494] | 9 |
|
---|
[13632] | 10 | <xsl:template match="Title" mode="Figure">
|
---|
[17494] | 11 | <xsl:param name="no"/>
|
---|
| 12 | <div style="margin-right:1.7pt;" align="center">
|
---|
| 13 | <b>Figure <xsl:value-of select="$no"/>
|
---|
| 14 | <!-- if contains subtitle, display subtitle together with the figure's title -->
|
---|
| 15 | <xsl:if test="SubTitle"><xsl:value-of select="SubTitle"/></xsl:if>
|
---|
| 16 |  <xsl:apply-templates select="Text"/></b>
|
---|
| 17 | </div>
|
---|
| 18 | </xsl:template>
|
---|
[13632] | 19 |
|
---|
| 20 | <xsl:template match="Title" mode="Table">
|
---|
| 21 | <div style="margin-right:1.7pt;" align="center">
|
---|
| 22 | <b>Table <xsl:number count="Table[not(@class='hidden')]" level="any"/> <xsl:apply-templates/></b></div>
|
---|
[17494] | 23 | </xsl:template>
|
---|
| 24 |
|
---|
[13861] | 25 |
|
---|
[17494] | 26 | <xsl:template match="NumberedList"><ol><xsl:apply-templates/></ol></xsl:template>
|
---|
[13632] | 27 | <xsl:template match="NumberedItem"><li><xsl:apply-templates/></li></xsl:template>
|
---|
| 28 |
|
---|
[13861] | 29 |
|
---|
[13632] | 30 | <xsl:template match="BulletList">
|
---|
[17494] | 31 | <xsl:if test="not(parent::Bullet)">
|
---|
| 32 | <ul style="list-style-type: disc;">
|
---|
| 33 | <xsl:for-each select="Bullet">
|
---|
| 34 | <li><xsl:apply-templates/></li>
|
---|
| 35 | <xsl:if test="BulletList">
|
---|
| 36 | <xsl:for-each select="BulletList">
|
---|
| 37 | <ul style="list-style-type: disc;"><xsl:for-each select="Bullet"><li><xsl:apply-templates/></li></xsl:for-each></ul>
|
---|
| 38 | </xsl:for-each>
|
---|
| 39 | </xsl:if>
|
---|
| 40 | </xsl:for-each>
|
---|
| 41 | </ul>
|
---|
| 42 | <p/>
|
---|
| 43 | </xsl:if>
|
---|
[13632] | 44 | </xsl:template>
|
---|
| 45 |
|
---|
[13861] | 46 |
|
---|
[13632] | 47 | <xsl:template match="Text">
|
---|
[17494] | 48 | <xsl:choose>
|
---|
| 49 | <xsl:when test="parent::Indented"><p class="indented"><xsl:apply-templates/></p> </xsl:when>
|
---|
| 50 | <xsl:when test="parent::Title|parent::Footnote"><xsl:apply-templates/></xsl:when>
|
---|
| 51 | <xsl:when test="not(parent::Version) and not(parent::Date) and not(parent::NumberedItem) and not(parent::Bullet)">
|
---|
| 52 | <p><xsl:apply-templates/></p>
|
---|
| 53 | </xsl:when>
|
---|
| 54 | <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
|
---|
| 55 | </xsl:choose>
|
---|
[13632] | 56 | </xsl:template>
|
---|
| 57 |
|
---|
[13861] | 58 |
|
---|
[13632] | 59 | <xsl:template match="CodeLine">
|
---|
[17494] | 60 | <xsl:choose>
|
---|
| 61 | <!-- codeline in figure or table -->
|
---|
| 62 | <xsl:when test="parent::Figure or parent::th"><div class="codeline_figure"><xsl:apply-templates/></div></xsl:when>
|
---|
| 63 | <!-- consecutive codelines -->
|
---|
| 64 | <xsl:when test="name(preceding-sibling::*[position()=1])='CodeLine' or name(following-sibling::*[position()=1])='CodeLine'">
|
---|
| 65 | <div class="codeline"><xsl:apply-templates/></div>
|
---|
| 66 | </xsl:when>
|
---|
| 67 | <!-- a single line of code between two text paragraphs -->
|
---|
| 68 | <xsl:otherwise><div class="codeline_single"><xsl:apply-templates/></div></xsl:otherwise>
|
---|
| 69 | </xsl:choose>
|
---|
[13632] | 70 | </xsl:template>
|
---|
[13861] | 71 |
|
---|
[13632] | 72 |
|
---|
| 73 | <xsl:template match="Figure">
|
---|
| 74 | <a id="Figure_{@id}"/>
|
---|
[17494] | 75 | <!-- no of current figure = total_number_of_previous_figure - total_number_of_previous_sub_figures-->
|
---|
[13632] | 76 | <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>
|
---|
| 77 | <xsl:variable name="temp_num_of_sub_figs">
|
---|
[17494] | 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>
|
---|
[13861] | 81 |
|
---|
[13632] | 82 | <p/>
|
---|
| 83 | <xsl:apply-templates select="Title" mode="Figure"><xsl:with-param name="no" select="$no"/></xsl:apply-templates>
|
---|
[17494] | 84 |
|
---|
[13632] | 85 | <xsl:choose>
|
---|
[17494] | 86 | <xsl:when test="CodeLine">
|
---|
| 87 | <table class="figure_code" align="center">
|
---|
| 88 | <xsl:for-each select="*[not(name()='Title')]">
|
---|
| 89 | <tr>
|
---|
| 90 | <xsl:if test="parent::Figure[@class='withLineNumber']">
|
---|
| 91 | <td><div class="linenumber"><xsl:number value="position()" format="1"/>  </div></td>
|
---|
| 92 | </xsl:if>
|
---|
| 93 | <td><xsl:apply-templates select="."/></td>
|
---|
| 94 | </tr>
|
---|
| 95 | </xsl:for-each>
|
---|
| 96 | </table>
|
---|
| 97 | </xsl:when>
|
---|
| 98 |
|
---|
| 99 | <xsl:when test="File"><div align="center"><xsl:apply-templates select="File"/></div><br/></xsl:when>
|
---|
[13632] | 100 | </xsl:choose>
|
---|
| 101 | <br/>
|
---|
| 102 | </xsl:template>
|
---|
| 103 |
|
---|
[13861] | 104 |
|
---|
[13632] | 105 | <xsl:template match="Table">
|
---|
[13861] | 106 | <p/><a id="Table_{@id}"/>
|
---|
[13632] | 107 | <xsl:if test="not(@class='hidden') and not(normalize-space(Title/Text)='')"><xsl:apply-templates select="Title" mode="Table"/></xsl:if>
|
---|
[17494] | 108 |
|
---|
[13632] | 109 | <table cellpadding="2pt" cellspacing="2pt">
|
---|
[17494] | 110 | <xsl:if test="not(@class='hidden')">
|
---|
| 111 | <xsl:if test="not(../../@class='hidden')">
|
---|
| 112 | <xsl:attribute name="style">border-collapse:collapse;border:1px solid black;</xsl:attribute>
|
---|
| 113 | </xsl:if>
|
---|
| 114 | <xsl:attribute name="rules">rows</xsl:attribute>
|
---|
| 115 | <xsl:attribute name="align">center</xsl:attribute>
|
---|
| 116 | </xsl:if>
|
---|
| 117 |
|
---|
| 118 | <xsl:if test="@class='hidden'">
|
---|
| 119 | <xsl:attribute name="width">90%</xsl:attribute>
|
---|
| 120 | <xsl:attribute name="align">center</xsl:attribute>
|
---|
| 121 | </xsl:if>
|
---|
| 122 |
|
---|
| 123 | <xsl:for-each select="TableContent/tr">
|
---|
| 124 | <tr>
|
---|
| 125 | <xsl:if test="not(../../@class='hidden')">
|
---|
| 126 | <xsl:attribute name="style">border-collapse:collapse;border:1px solid black;</xsl:attribute>
|
---|
| 127 | </xsl:if>
|
---|
| 128 | <xsl:for-each select="th">
|
---|
| 129 | <td valign="top">
|
---|
| 130 | <xsl:if test="File"><xsl:attribute name="align">right</xsl:attribute></xsl:if>
|
---|
| 131 | <xsl:apply-templates select="node()"/></td>
|
---|
| 132 | </xsl:for-each>
|
---|
| 133 | </tr>
|
---|
| 134 | </xsl:for-each>
|
---|
[13632] | 135 | </table>
|
---|
| 136 | <br/>
|
---|
| 137 | </xsl:template>
|
---|
| 138 |
|
---|
[13861] | 139 |
|
---|
[13632] | 140 | <xsl:template match="Section">
|
---|
[17494] | 141 | <a name="Section_{@id}"/>
|
---|
| 142 | <h3>
|
---|
| 143 | <xsl:if test="not(starts-with(../../@id, 'appendix'))">
|
---|
| 144 | <xsl:number level="multiple" format="1.1" count="//Chapter|//Chapter//Section"/> 
|
---|
| 145 | </xsl:if>
|
---|
| 146 | <xsl:apply-templates select="Title/Text"/>
|
---|
| 147 | </h3>
|
---|
| 148 | <xsl:apply-templates select="Content/*"/>
|
---|
[13632] | 149 | </xsl:template>
|
---|
| 150 |
|
---|
[13861] | 151 |
|
---|
[13632] | 152 | <xsl:template match="Section" mode="preface">
|
---|
| 153 | <h3><xsl:apply-templates select="Title/Text"/></h3>
|
---|
| 154 | <xsl:apply-templates select="Content/*"/>
|
---|
| 155 | </xsl:template>
|
---|
| 156 |
|
---|
[13861] | 157 |
|
---|
[13632] | 158 | <xsl:template match="Subsection">
|
---|
| 159 | <a name="Subsection_{@id}"/>
|
---|
| 160 | <h4><xsl:apply-templates select="Title/Text"/></h4>
|
---|
| 161 | <xsl:apply-templates select="Content/*"/>
|
---|
| 162 | </xsl:template>
|
---|
| 163 |
|
---|
[13861] | 164 |
|
---|
[17494] | 165 | <xsl:template match="Part"><a id="Part_{@id}"/><xsl:apply-templates/></xsl:template>
|
---|
| 166 |
|
---|
| 167 | <xsl:template match="Comment"><xsl:apply-templates/></xsl:template>
|
---|
| 168 |
|
---|
[13632] | 169 | <xsl:template match="Indented"><p><div style="margin-left: 1em;"><xsl:apply-templates/></div></p></xsl:template>
|
---|
[17494] | 170 |
|
---|
[13632] | 171 | <xsl:template match="img|table|br|td|tr|th">
|
---|
[17494] | 172 | <xsl:copy><xsl:for-each select="@*"><xsl:copy/></xsl:for-each><xsl:apply-templates/></xsl:copy>
|
---|
| 173 | </xsl:template>
|
---|
| 174 |
|
---|
| 175 | <xsl:template match="i|b|u"><xsl:element name="{name()}"><xsl:apply-templates/></xsl:element></xsl:template>
|
---|
| 176 |
|
---|
| 177 | <xsl:template match="File">
|
---|
| 178 | <a href="../{@url}" target="_blank"><img src="../{@url}" width="{@width}" height="{@height}" border="0"/></a>
|
---|
| 179 | </xsl:template>
|
---|
| 180 |
|
---|
[13861] | 181 | <xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
|
---|
[17494] | 182 |
|
---|
[13632] | 183 | <xsl:template match="Author"><b><xsl:apply-templates/></b></xsl:template>
|
---|
[17494] | 184 |
|
---|
[13632] | 185 | <xsl:template match="Affiliation"><i><xsl:apply-templates/></i></xsl:template>
|
---|
| 186 |
|
---|
[17494] | 187 | <xsl:template name="version_and_date">
|
---|
| 188 | <p><b><xsl:apply-templates select="Version/Text"/></b>  <xsl:apply-templates select="Date/Text"/></p>
|
---|
| 189 | </xsl:template>
|
---|
[13861] | 190 |
|
---|
[13632] | 191 | <xsl:template match="Chapter|Appendix|Bibliography" mode="index">
|
---|
[17494] | 192 | <dt><a href="#Chapter_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt>
|
---|
| 193 | <xsl:for-each select="Content/Section">
|
---|
| 194 | <dd><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dd>
|
---|
| 195 | </xsl:for-each>
|
---|
| 196 | </xsl:template>
|
---|
[13632] | 197 |
|
---|
[13861] | 198 |
|
---|
[13632] | 199 | <xsl:template match="Section" mode="index">
|
---|
[17494] | 200 | <dt><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt>
|
---|
[13632] | 201 | </xsl:template>
|
---|
| 202 |
|
---|
[13861] | 203 |
|
---|
[17494] | 204 | <xsl:template match="Chapter">
|
---|
| 205 | <a id="Chapter_{@id}"/>
|
---|
| 206 | <h2>
|
---|
| 207 | <xsl:if test="not(starts-with(@id, 'appendix')) and not(starts-with(@id, 'biblio'))">
|
---|
| 208 | <xsl:value-of select="position()"/>
|
---|
| 209 | </xsl:if>
|
---|
| 210 |  <xsl:apply-templates select="Title/Text"/>
|
---|
| 211 | </h2>
|
---|
| 212 | <xsl:apply-templates select="Content/*"/>
|
---|
| 213 | </xsl:template>
|
---|
[13632] | 214 |
|
---|
| 215 |
|
---|
[17494] | 216 | <xsl:template match="Figure" mode="ref">
|
---|
| 217 | <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>
|
---|
| 218 | <xsl:variable name="temp_num_of_sub_figs">
|
---|
| 219 | <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
|
---|
| 220 | </xsl:variable>
|
---|
| 221 |
|
---|
| 222 | <xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
|
---|
| 223 |
|
---|
| 224 | <xsl:variable name="subtitle">
|
---|
| 225 | <xsl:if test="Title/SubTitle"><xsl:value-of select="substring-before(substring-after(Title/SubTitle, '('), ')')"/></xsl:if>
|
---|
| 226 | </xsl:variable>
|
---|
| 227 |
|
---|
| 228 | <xsl:value-of select="concat($no, $subtitle)"/>
|
---|
[13632] | 229 | </xsl:template>
|
---|
[17494] | 230 |
|
---|
[13861] | 231 | <xsl:template match="Table" mode="ref"><xsl:number count="Table[not(@class='hidden')]" level="any"/></xsl:template>
|
---|
[17494] | 232 |
|
---|
[13632] | 233 | <xsl:template match="Chapter" mode="ref"><xsl:number level="any"/></xsl:template>
|
---|
[17494] | 234 |
|
---|
[13632] | 235 | <xsl:template match="Section" mode="ref"><xsl:number count="//Chapter|//Chapter//Section" format="1.1" level="multiple"/></xsl:template>
|
---|
[13785] | 236 |
|
---|
[17494] | 237 | <xsl:template match="Subsection" mode="ref">
|
---|
| 238 | <xsl:number level="multiple" format="1.1.1" count="//Chapter|//Chapter//Section|//Chapter//Section//Subsection"/>
|
---|
| 239 | </xsl:template>
|
---|
[13785] | 240 |
|
---|
[17494] | 241 |
|
---|
| 242 | <xsl:template match="SupplementaryText">
|
---|
| 243 | <xsl:param name="manual_id" select="''"/>
|
---|
| 244 | <xsl:param name="manual_lang" select="''"/>
|
---|
| 245 | <xsl:for-each select="Text">
|
---|
| 246 | <div class="indexlink"><a class="indexlink">
|
---|
| 247 | <xsl:if test="@id='manual_index'">
|
---|
| 248 | <xsl:attribute name="href"><xsl:value-of select="$manual_id"/>_<xsl:value-of select="$manual_lang"/>_index.html</xsl:attribute>
|
---|
| 249 | </xsl:if>
|
---|
| 250 | <xsl:if test="@id='top_index'"><xsl:attribute name="href">../../index.html</xsl:attribute></xsl:if>
|
---|
| 251 | <xsl:value-of select="."/></a></div>
|
---|
| 252 | </xsl:for-each>
|
---|
[13785] | 253 | </xsl:template>
|
---|
[14096] | 254 |
|
---|
[17494] | 255 |
|
---|
[14096] | 256 | <xsl:template match="Link">
|
---|
| 257 | <xsl:choose>
|
---|
| 258 | <xsl:when test="not(parent::Text)">
|
---|
| 259 | <p><div style="margin-left: 2em;">
|
---|
[17494] | 260 | <a>
|
---|
| 261 | <xsl:attribute name="href">
|
---|
| 262 | <xsl:choose>
|
---|
| 263 | <xsl:when test="@url"><xsl:value-of select="@url"/></xsl:when>
|
---|
| 264 | <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
---|
| 265 | </xsl:choose>
|
---|
| 266 | </xsl:attribute>
|
---|
| 267 | <xsl:value-of select="."/>
|
---|
| 268 | </a>
|
---|
| 269 | </div></p>
|
---|
[14096] | 270 | </xsl:when>
|
---|
| 271 | <xsl:otherwise>
|
---|
[17494] | 272 | <a>
|
---|
| 273 | <xsl:attribute name="href">
|
---|
| 274 | <xsl:choose>
|
---|
| 275 | <xsl:when test="@url"><xsl:value-of select="@url"/></xsl:when>
|
---|
| 276 | <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
---|
| 277 | </xsl:choose>
|
---|
| 278 | </xsl:attribute>
|
---|
| 279 | <xsl:value-of select="."/>
|
---|
| 280 | </a>
|
---|
[14096] | 281 | </xsl:otherwise>
|
---|
| 282 | </xsl:choose>
|
---|
| 283 | </xsl:template>
|
---|
[17494] | 284 | </xsl:stylesheet> |
---|