home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / xml / gnome / xslt / docbook / html / db2html-index.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2009-03-17  |  8.4 KB  |  231 lines

  1. <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
  2. <!--
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU Lesser General Public License as published by the Free
  5. Software Foundation; either version 2 of the License, or (at your option) any
  6. later version.
  7.  
  8. This program is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  11. details.
  12.  
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with this program; see the file COPYING.LGPL.  If not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. -->
  18.  
  19. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20.                 xmlns:msg="http://www.gnome.org/~shaunm/gnome-doc-utils/l10n"
  21.                 xmlns:set="http://exslt.org/sets"
  22.                 xmlns="http://www.w3.org/1999/xhtml"
  23.                 exclude-result-prefixes="msg set"
  24.                 version="1.0">
  25.  
  26. <!--!!==========================================================================
  27. DocBook to HTML - Indexes
  28. :Requires: db-chunk db2html-division gettext
  29.  
  30. This module provides templates to process DocBook indexes.
  31. -->
  32.  
  33. <!-- FIXME:
  34. indexdiv
  35. seeie
  36. seealsoie
  37. indexterm (autoidx)
  38. -->
  39.  
  40. <!-- == Matched Templates == -->
  41.  
  42. <!-- = suppress = -->
  43. <xsl:template match="primaryie"/>
  44. <xsl:template match="secondaryie"/>
  45. <xsl:template match="tertiaryie"/>
  46.  
  47. <!-- = indexentry = -->
  48. <xsl:template match="indexentry">
  49.   <dt class="primaryie">
  50.     <xsl:apply-templates select="primaryie/node()"/>
  51.   </dt>
  52.   <xsl:variable name="pri_see"
  53.                 select="seeie[not(preceding-sibling::secondaryie)]"/>
  54.   <xsl:variable name="pri_seealso"
  55.                 select="seealsoie[not(preceding-sibling::secondaryie)]"/>
  56.   <xsl:if test="$pri_see">
  57.     <dd class="see">
  58.       <xsl:call-template name="l10n.gettext">
  59.         <xsl:with-param name="msgid" select="'seeie.format'"/>
  60.         <xsl:with-param name="node" select="$pri_see"/>
  61.         <xsl:with-param name="format" select="true()"/>
  62.       </xsl:call-template>
  63.     </dd>
  64.   </xsl:if>
  65.   <xsl:if test="$pri_seealso">
  66.     <dd class="seealso">
  67.       <xsl:call-template name="l10n.gettext">
  68.         <xsl:with-param name="msgid" select="'seealsoie.format'"/>
  69.         <xsl:with-param name="node" select="$pri_seealso"/>
  70.         <xsl:with-param name="format" select="true()"/>
  71.       </xsl:call-template>
  72.     </dd>
  73.   </xsl:if>
  74.   <xsl:for-each select="secondaryie">
  75.     <dd class="seconary">
  76.       <dl class="secondary">
  77.         <dt class="secondaryie">
  78.           <xsl:apply-templates/>
  79.         </dt>
  80.         <xsl:variable name="sec_see"
  81.                       select="following-sibling::seeie
  82.                                 [set:has-same-node(preceding-sibling::secondaryie[1], current())]"/>
  83.         <xsl:variable name="sec_seealso"
  84.                       select="following-sibling::seealsoie
  85.                                 [set:has-same-node(preceding-sibling::secondaryie[1], current())]"/>
  86.         <xsl:variable name="tertiary"
  87.                       select="following-sibling::tertiaryie
  88.                                 [set:has-same-node(preceding-sibling::secondaryie[1], current())]"/>
  89.         <xsl:if test="$sec_see">
  90.           <dd class="see">
  91.             <xsl:call-template name="l10n.gettext">
  92.               <xsl:with-param name="msgid" select="'seeie.format'"/>
  93.               <xsl:with-param name="node" select="$sec_see"/>
  94.               <xsl:with-param name="format" select="true()"/>
  95.             </xsl:call-template>
  96.           </dd>
  97.         </xsl:if>
  98.         <xsl:if test="$sec_seealso">
  99.           <dd class="seealso">
  100.             <xsl:call-template name="l10n.gettext">
  101.               <xsl:with-param name="msgid" select="'seealsoie.format'"/>
  102.               <xsl:with-param name="node" select="$sec_seealso"/>
  103.               <xsl:with-param name="format" select="true()"/>
  104.             </xsl:call-template>
  105.           </dd>
  106.         </xsl:if>
  107.         <xsl:if test="$tertiary">
  108.           <!-- FIXME -->
  109.         </xsl:if>
  110.       </dl>
  111.     </dd>
  112.   </xsl:for-each>
  113. </xsl:template>
  114.  
  115. <!-- = index = -->
  116. <xsl:template match="index">
  117.   <xsl:param name="depth_in_chunk">
  118.     <xsl:call-template name="db.chunk.depth-in-chunk"/>
  119.   </xsl:param>
  120.   <xsl:param name="depth_of_chunk">
  121.     <xsl:call-template name="db.chunk.depth-of-chunk"/>
  122.   </xsl:param>
  123.   <xsl:choose>
  124.     <xsl:when test="not(title) and not(indexinfo/title)">
  125.       <xsl:call-template name="db2html.division.div">
  126.         <xsl:with-param name="info" select="indexinfo"/>
  127.         <xsl:with-param name="divisions" select="indexdiv"/>
  128.         <xsl:with-param name="entries" select="indexentry"/>
  129.         <xsl:with-param name="title_content">
  130.           <xsl:call-template name="l10n.gettext">
  131.             <xsl:with-param name="msgid" select="'Index'"/>
  132.           </xsl:call-template>
  133.         </xsl:with-param>
  134.         <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
  135.         <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
  136.       </xsl:call-template>
  137.     </xsl:when>
  138.     <xsl:otherwise>
  139.       <xsl:call-template name="db2html.division.div">
  140.         <xsl:with-param name="info" select="indexinfo"/>
  141.         <xsl:with-param name="divisions" select="indexdiv"/>
  142.         <xsl:with-param name="entries" select="indexentry"/>
  143.         <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
  144.         <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
  145.       </xsl:call-template>
  146.     </xsl:otherwise>
  147.   </xsl:choose>
  148. </xsl:template>
  149.  
  150. <!-- = setindex = -->
  151. <xsl:template match="setindex">
  152.   <xsl:param name="depth_in_chunk">
  153.     <xsl:call-template name="db.chunk.depth-in-chunk"/>
  154.   </xsl:param>
  155.   <xsl:param name="depth_of_chunk">
  156.     <xsl:call-template name="db.chunk.depth-of-chunk"/>
  157.   </xsl:param>
  158.   <xsl:choose>
  159.     <xsl:when test="not(title) and not(setindexinfo/title)">
  160.       <xsl:call-template name="db2html.division.div">
  161.         <xsl:with-param name="info" select="setindexinfo"/>
  162.         <xsl:with-param name="divisions" select="indexdiv"/>
  163.         <xsl:with-param name="entries" select="indexentry"/>
  164.         <xsl:with-param name="title_content">
  165.           <xsl:call-template name="l10n.gettext">
  166.             <xsl:with-param name="msgid" select="'Index'"/>
  167.           </xsl:call-template>
  168.         </xsl:with-param>
  169.         <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
  170.         <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
  171.       </xsl:call-template>
  172.     </xsl:when>
  173.     <xsl:otherwise>
  174.       <xsl:call-template name="db2html.division.div">
  175.         <xsl:with-param name="info" select="setindexinfo"/>
  176.         <xsl:with-param name="divisions" select="indexdiv"/>
  177.         <xsl:with-param name="entries" select="indexentry"/>
  178.         <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
  179.         <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
  180.       </xsl:call-template>
  181.     </xsl:otherwise>
  182.   </xsl:choose>
  183. </xsl:template>
  184.  
  185. <!--#% l10n.format.mode -->
  186. <xsl:template mode="l10n.format.mode" match="msg:seeie">
  187.   <xsl:param name="node"/>
  188.   <xsl:for-each select="$node">
  189.     <xsl:if test="position() != 1">
  190.       <xsl:call-template name="l10n.gettext">
  191.         <xsl:with-param name="msgid" select="', '"/>
  192.       </xsl:call-template>
  193.     </xsl:if>
  194.     <xsl:value-of select="."/>
  195. <!--
  196.     <xsl:choose>
  197.       <xsl:when test="@otherterm">
  198.         <a>
  199.           <xsl:attribute name="href">
  200.             <xsl:call-template name="db.xref.target">
  201.               <xsl:with-param name="linkend" select="@otherterm"/>
  202.             </xsl:call-template>
  203.           </xsl:attribute>
  204.           <xsl:attribute name="title">
  205.             <xsl:call-template name="db.xref.tooltip">
  206.               <xsl:with-param name="linkend" select="@otherterm"/>
  207.             </xsl:call-template>
  208.           </xsl:attribute>
  209.           <xsl:choose>
  210.             <xsl:when test="normalize-space(.) != ''">
  211.               <xsl:apply-templates/>
  212.             </xsl:when>
  213.             <xsl:otherwise>
  214.               <xsl:call-template name="db.xref.content">
  215.                 <xsl:with-param name="linkend" select="@otherterm"/>
  216.                 <xsl:with-param name="role" select="'glosssee'"/>
  217.               </xsl:call-template>
  218.             </xsl:otherwise>
  219.           </xsl:choose>
  220.         </a>
  221.       </xsl:when>
  222.       <xsl:otherwise>
  223.         <xsl:apply-templates/>
  224.       </xsl:otherwise>
  225.     </xsl:choose>
  226. -->
  227.   </xsl:for-each>
  228. </xsl:template>
  229.  
  230. </xsl:stylesheet>
  231.