Ignore:
Timestamp:
2008-10-08T13:59:48+13:00 (16 years ago)
Author:
anna
Message:

Updated tutorials and associated files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/manuals/processing/common.xsl

    r14096 r17494  
    55  xmlns:util="ExternalRef" extension-element-prefixes="util">
    66 
     7  <!-- Various Title templates -->
    78  <xsl:template match="Title"><p><b><i><xsl:apply-templates/></i></b></p></xsl:template>
    8  
    9  
     9   
    1010  <xsl:template match="Title" mode="Figure">
    11     <xsl:param name="no"/>
    12     <div style="margin-right:1.7pt;" align="center"><b>Figure&#160;<xsl:value-of select="$no"/>
    13             <xsl:if test="SubTitle"><xsl:value-of select="SubTitle"/></xsl:if>&#160;
    14             <xsl:apply-templates select="Text"/></b>
    15         </div>
    16   </xsl:template>
    17  
     11    <xsl:param name="no"/>
     12    <div style="margin-right:1.7pt;" align="center">
     13      <b>Figure&#160;<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      &#160;<xsl:apply-templates select="Text"/></b>
     17      </div>
     18  </xsl:template> 
    1819 
    1920  <xsl:template match="Title" mode="Table">       
    2021    <div style="margin-right:1.7pt;" align="center">
    2122    <b>Table&#160;<xsl:number count="Table[not(@class='hidden')]" level="any"/>&#160;<xsl:apply-templates/></b></div>
    22   </xsl:template>
    23  
    24 
    25     <xsl:template match="NumberedList"><ol><xsl:apply-templates/></ol></xsl:template>
     23  </xsl:template> 
     24
     25 
     26  <xsl:template match="NumberedList"><ol><xsl:apply-templates/></ol></xsl:template>
    2627  <xsl:template match="NumberedItem"><li><xsl:apply-templates/></li></xsl:template>
    2728
    2829
    2930  <xsl:template match="BulletList">
    30     <xsl:if test="not(parent::Bullet)">
    31     <ul style="list-style-type: disc;"><xsl:for-each select="Bullet"><li><xsl:apply-templates/></li>
    32         <xsl:if test="BulletList">
    33         <xsl:for-each select="BulletList"><ul style="list-style-type: disc;"><xsl:for-each select="Bullet"><li><xsl:apply-templates/></li></xsl:for-each></ul>
    34         </xsl:for-each></xsl:if></xsl:for-each></ul><p/></xsl:if>
     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>
    3544  </xsl:template>
    3645
    3746
    3847  <xsl:template match="Text">
    39     <xsl:choose>
    40         <xsl:when test="parent::Indented"><p class="indented"><xsl:apply-templates/></p>    </xsl:when>
    41         <xsl:when test="parent::Title|parent::Footnote"><xsl:apply-templates/></xsl:when>
    42         <xsl:when test="not(parent::Version) and not(parent::Date) and not(parent::NumberedItem) and not(parent::Bullet)"><p><xsl:apply-templates/></p></xsl:when>
    43         <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
    44     </xsl:choose>   
     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>   
    4556  </xsl:template>
    4657
    4758
    4859  <xsl:template match="CodeLine"> 
    49   <xsl:choose>
    50   <!-- codeline in figure or table -->
    51     <xsl:when test="parent::Figure or parent::th"><div class="codeline_figure"><xsl:apply-templates/></div></xsl:when>     
    52     <!-- consecutive codelines -->
    53     <xsl:when test="name(preceding-sibling::*[position()=1])='CodeLine' or name(following-sibling::*[position()=1])='CodeLine'"><div class="codeline"><xsl:apply-templates/></div></xsl:when>     
    54     <!-- a single line of code between two text paragraphs -->
    55     <xsl:otherwise><div class="codeline_single"><xsl:apply-templates/></div></xsl:otherwise>
    56   </xsl:choose> 
     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> 
    5770  </xsl:template>
    5871 
     
    6073  <xsl:template match="Figure">
    6174    <a id="Figure_{@id}"/>
    62     <!-- number of current figure = total_number_of_previous_figure - total_number_of_previous_sub_figures-->
     75    <!-- no of current figure = total_number_of_previous_figure - total_number_of_previous_sub_figures-->
    6376    <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>       
    6477    <xsl:variable name="temp_num_of_sub_figs">
    65             <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
    66     </xsl:variable>         
    67     <xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
     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>
    6881       
    6982    <p/>       
    7083    <xsl:apply-templates select="Title" mode="Figure"><xsl:with-param name="no" select="$no"/></xsl:apply-templates>
     84   
    7185    <xsl:choose>   
    72     <xsl:when test="CodeLine">
    73       <table class="figure_code" align="center">
    74       <xsl:for-each select="*[not(name()='Title')]">
    75         <tr>
    76         <xsl:if test="parent::Figure[@class='withLineNumber']">
    77         <td><div class="linenumber"><xsl:number value="position()" format="1"/>&#160;&#160;</div></td></xsl:if>
    78         <td><xsl:apply-templates select="."/></td></tr>
    79       </xsl:for-each>
    80       </table>
    81     </xsl:when>
    82     <xsl:when test="File"><div align="center"><xsl:apply-templates select="File"/></div><br/>
    83         </xsl:when>   
     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"/>&#160;&#160;</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>   
    84100    </xsl:choose>
    85101    <br/>
     
    90106    <p/><a id="Table_{@id}"/>
    91107    <xsl:if test="not(@class='hidden') and not(normalize-space(Title/Text)='')"><xsl:apply-templates select="Title" mode="Table"/></xsl:if>
     108   
    92109    <table cellpadding="2pt" cellspacing="2pt">
    93     <xsl:if test="not(@class='hidden')">
    94       <xsl:if test="not(../../@class='hidden')"><xsl:attribute name="style">border-collapse:collapse;border:1px solid black;</xsl:attribute></xsl:if>
    95       <xsl:attribute name="rules">rows</xsl:attribute><xsl:attribute name="align">center</xsl:attribute>       
    96     </xsl:if>
    97     <xsl:if test="@class='hidden'"><xsl:attribute name="width">90%</xsl:attribute><xsl:attribute name="align">center</xsl:attribute></xsl:if>
    98     <xsl:for-each select="TableContent/tr">
    99     <tr>
    100       <xsl:if test="not(../../@class='hidden')"><xsl:attribute name="style">border-collapse:collapse;border:1px solid black;</xsl:attribute></xsl:if>
    101     <xsl:for-each select="th"><td valign="top"><xsl:if test="File"><xsl:attribute name="align">right</xsl:attribute></xsl:if>
    102     <xsl:apply-templates select="node()"/></td></xsl:for-each>
    103       </tr>
    104     </xsl:for-each>
     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>
    105135    </table>
    106136    <br/>
     
    109139
    110140  <xsl:template match="Section">     
    111     <a name="Section_{@id}"/><h3><xsl:if test="not(starts-with(../../@id, 'appendix'))">
    112     <xsl:number level="multiple" format="1.1" count="//Chapter|//Chapter//Section"/>&#160;</xsl:if>
    113     <xsl:apply-templates select="Title/Text"/></h3><xsl:apply-templates select="Content/*"/>
     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"/>&#160;
     145    </xsl:if>
     146    <xsl:apply-templates select="Title/Text"/>
     147    </h3>
     148    <xsl:apply-templates select="Content/*"/>
    114149  </xsl:template>
    115150
     
    128163 
    129164 
    130   <xsl:template match="Part"><a id="Part_{@id}"/><xsl:apply-templates/></xsl:template>   
    131   <xsl:template match="Comment"><xsl:apply-templates/></xsl:template> 
     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 
    132169  <xsl:template match="Indented"><p><div style="margin-left: 1em;"><xsl:apply-templates/></div></p></xsl:template>
     170 
    133171  <xsl:template match="img|table|br|td|tr|th">
    134     <xsl:copy><xsl:for-each select="@*"><xsl:copy/></xsl:for-each><xsl:apply-templates/></xsl:copy>
     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 
     181  <xsl:template match="text()"><xsl:value-of select="."/></xsl:template> 
     182 
     183  <xsl:template match="Author"><b><xsl:apply-templates/></b></xsl:template>
     184 
     185  <xsl:template match="Affiliation"><i><xsl:apply-templates/></i></xsl:template>
     186 
     187  <xsl:template name="version_and_date">
     188    <p><b><xsl:apply-templates select="Version/Text"/></b>&#160;&#160;<xsl:apply-templates select="Date/Text"/></p>
     189  </xsl:template>   
     190 
     191  <xsl:template match="Chapter|Appendix|Bibliography" mode="index">
     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>
     197
     198
     199  <xsl:template match="Section" mode="index">
     200    <dt><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt> 
     201  </xsl:template>
     202
     203
     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      &#160;<xsl:apply-templates select="Title/Text"/>
     211    </h2>
     212    <xsl:apply-templates select="Content/*"/>
     213  </xsl:template>
     214 
     215
     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)"/>
     229  </xsl:template> 
     230 
     231  <xsl:template match="Table" mode="ref"><xsl:number count="Table[not(@class='hidden')]" level="any"/></xsl:template>
     232 
     233  <xsl:template match="Chapter" mode="ref"><xsl:number level="any"/></xsl:template>
     234 
     235  <xsl:template match="Section" mode="ref"><xsl:number count="//Chapter|//Chapter//Section" format="1.1" level="multiple"/></xsl:template>
     236 
     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>
     240 
     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>
    135253  </xsl:template>
    136   <xsl:template match="i|b|u"><xsl:element name="{name()}"><xsl:apply-templates/></xsl:element></xsl:template> 
    137   <xsl:template match="File"><a href="../{@url}" target="_blank"><img src="../{@url}" width="{@width}" height="{@height}" border="0"/></a></xsl:template>
    138   <xsl:template match="text()"><xsl:value-of select="."/></xsl:template> 
    139   <xsl:template match="Author"><b><xsl:apply-templates/></b></xsl:template>
    140   <xsl:template match="Affiliation"><i><xsl:apply-templates/></i></xsl:template>
    141   <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> 
    142  
    143  
    144   <xsl:template match="Chapter|Appendix|Bibliography" mode="index">
    145   <dt><a href="#Chapter_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt>
    146   <xsl:for-each select="Content/Section"><dd><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dd></xsl:for-each>
    147 </xsl:template>
    148 
    149 
    150   <xsl:template match="Section" mode="index">
    151   <dt><a href="#Section_{@id}"><xsl:apply-templates select="Title/Text"/></a></dt> 
    152   </xsl:template>
    153 
    154 
    155 <xsl:template match="Chapter">
    156   <a id="Chapter_{@id}"/>   
    157   <h2><xsl:if test="not(starts-with(@id, 'appendix')) and not(starts-with(@id, 'biblio'))">
    158   <xsl:value-of select="position()"/></xsl:if>&#160;<xsl:apply-templates select="Title/Text"/></h2>
    159   <xsl:apply-templates select="Content/*"/>
    160 </xsl:template>
    161  
    162 
    163 <xsl:template match="Figure" mode="ref">
    164     <xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>       
    165     <xsl:variable name="temp_num_of_sub_figs">
    166     <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
    167     </xsl:variable>     
    168     <xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
    169     <xsl:variable name="subtitle">
    170     <xsl:if test="Title/SubTitle"><xsl:value-of select="substring-before(substring-after(Title/SubTitle, '('), ')')"/></xsl:if>
    171     </xsl:variable>
    172     <xsl:value-of select="concat($no, $subtitle)"/>
    173   </xsl:template> 
    174   <xsl:template match="Table" mode="ref"><xsl:number count="Table[not(@class='hidden')]" level="any"/></xsl:template>
    175   <xsl:template match="Chapter" mode="ref"><xsl:number level="any"/></xsl:template>
    176   <xsl:template match="Section" mode="ref"><xsl:number count="//Chapter|//Chapter//Section" format="1.1" level="multiple"/></xsl:template>
    177   <xsl:template match="Subsection" mode="ref"><xsl:number level="multiple" format="1.1.1" count="//Chapter|//Chapter//Section|//Chapter//Section//Subsection"/></xsl:template>
    178  
    179  
    180 <xsl:template match="SupplementaryText">
    181     <xsl:param name="manual_id" select="''"/>
    182     <xsl:param name="manual_lang" select="''"/>     
    183     <xsl:for-each select="Text">
    184         <div class="indexlink"><a class="indexlink">
    185         <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>
    186         <xsl:if test="@id='top_index'"><xsl:attribute name="href">../../index.html</xsl:attribute></xsl:if>
    187         <xsl:value-of select="."/></a></div>
    188     </xsl:for-each>
    189   </xsl:template>
     254 
    190255 
    191256  <xsl:template match="Link">
     
    193258      <xsl:when test="not(parent::Text)">
    194259    <p><div style="margin-left: 2em;">
    195         <a><xsl:attribute name="href"><xsl:choose><xsl:when test="@url"><xsl:value-of select="@url"/></xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose></xsl:attribute><xsl:value-of select="."/></a>
    196       </div></p>
     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>
    197270      </xsl:when>
    198271      <xsl:otherwise>
    199     <a><xsl:attribute name="href"><xsl:choose><xsl:when test="@url"><xsl:value-of select="@url"/></xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose></xsl:attribute><xsl:value-of select="."/></a>
     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>
    200281      </xsl:otherwise>
    201282    </xsl:choose>
Note: See TracChangeset for help on using the changeset viewer.