home *** CD-ROM | disk | FTP | other *** search
/ Encyclopaedia Britannica …oncise Encyclopedia 2007 / bcd_concise07.iso / data / jars / oec2-lib.jar / xsl / shared / ImarsIndex.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2006-08-25  |  11.3 KB  |  315 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <xsl:stylesheet 
  4.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.     xmlns:html="http://www.w3.org/TR/html4/loose.dtd"
  6.     exclude-result-prefixes="html"
  7.     version="1.0">
  8.  
  9.   <xsl:import href="Variables.xsl"/>
  10.  
  11.   <xsl:output method="html" encoding="UTF-8"/>
  12.  
  13.   <xsl:template match="index_entry">
  14.     <xsl:choose>
  15.       <xsl:when test="not(short_articles) and article_ref"><xsl:apply-templates select="headword" mode="linked"/></xsl:when>
  16.       <xsl:otherwise><xsl:apply-templates select="headword"/></xsl:otherwise>
  17.     </xsl:choose>
  18.     <ul><xsl:apply-templates select="short_articles | article_ref | bboys | stats | tables | photographs | illustrations | diagrams | graphs | figures | struct_formulae | chem_formulae | maps | periodic_tables | flags | images | videos | audio | animations | multimedia | text_refs"/></ul>
  19.   </xsl:template>
  20.  
  21.   <xsl:template name="text_link">
  22.     <xsl:param name="articleId"></xsl:param>
  23.     <xsl:param name="body"></xsl:param>
  24.  
  25.     <a href="{$articleURL}?ArticleId={$articleId}">
  26.       <xsl:choose>
  27.         <xsl:when test="$body != ''"><xsl:value-of select="$body"/></xsl:when>
  28.         <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
  29.       </xsl:choose>
  30.     </a>
  31.   </xsl:template>
  32.  
  33.   <xsl:template name="assembly_link">
  34.     <xsl:param name="id"></xsl:param>
  35.     <xsl:param name="body"></xsl:param>
  36.  
  37.     <a href="{$assemblyURL}?id={$id}&type=A">
  38.       <xsl:choose>
  39.         <xsl:when test="$body != ''"><xsl:value-of select="$body"/></xsl:when>
  40.         <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
  41.       </xsl:choose>
  42.     </a>
  43.   </xsl:template>
  44.  
  45.   <xsl:template name="binary_link">
  46.     <xsl:param name="id"></xsl:param>
  47.     <xsl:param name="body"></xsl:param>
  48.  
  49.     <a href="{$assemblyURL}?id={$id}&type=I">
  50.       <xsl:choose>
  51.         <xsl:when test="$body != ''"><xsl:value-of select="$body"/></xsl:when>
  52.         <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
  53.       </xsl:choose>
  54.     </a>
  55.   </xsl:template>
  56.  
  57.   <xsl:template name="index_link">
  58.     <xsl:param name="id"></xsl:param>
  59.     <xsl:param name="body"></xsl:param>
  60.     <xsl:choose>
  61.       <xsl:when test="$body != ''">
  62.         <a href="{$topicURL}?idxStructId={$id}">&typeId=13<xsl:value-of select="$body"/></a>
  63.       </xsl:when>
  64.       <xsl:otherwise>
  65.         <a href="{$topicURL}?idxStructId={$id}"><xsl:apply-templates/></a>
  66.       </xsl:otherwise>
  67.     </xsl:choose>
  68.   </xsl:template>
  69.  
  70.   <xsl:template match="headword" mode="linked">
  71.     <p>
  72.     <b>
  73.     <xsl:call-template name="text_link">
  74.       <xsl:with-param name="tocid"><xsl:value-of select="../article_ref//text_ref/@tocid"/></xsl:with-param>
  75.       <xsl:with-param name="articleId"><xsl:value-of select="../article_ref//text_ref/@artclid"/></xsl:with-param>
  76.       <xsl:with-param name="hook"><xsl:value-of select="../article_ref//text_ref/@hook"/></xsl:with-param>
  77.     </xsl:call-template>
  78.     </b>
  79.     </p>
  80.   </xsl:template>
  81.  
  82.   <xsl:template match="headword">
  83.     <p><b><xsl:apply-templates/></b></p>
  84.   </xsl:template>
  85.  
  86.   <xsl:template match="identifier">
  87.     (<xsl:apply-templates/>)
  88.   </xsl:template>
  89.  
  90.   <xsl:template match="short_articles">
  91.     <li>
  92.     <xsl:choose>
  93.       <xsl:when test="count(.//text_ref) > 1">
  94.         SUMMARY <xsl:call-template name="multi_ref"/>
  95.       </xsl:when>
  96.       <xsl:otherwise>
  97.         <xsl:call-template name="text_link">
  98.           <xsl:with-param name="articleId"><xsl:value-of select=".//text_ref/@artclid"/></xsl:with-param>
  99.           <xsl:with-param name="tocId"><xsl:value-of select=".//text_ref/@tocid"/></xsl:with-param>
  100.           <xsl:with-param name="body">SUMMARY</xsl:with-param>
  101.         </xsl:call-template>
  102.       </xsl:otherwise>
  103.     </xsl:choose>
  104.     </li>
  105.   </xsl:template>
  106.  
  107.   <xsl:template match="article_ref">a 1
  108.     <xsl:if test="../short_articles">
  109.       <li>
  110.       <xsl:choose>
  111.         <xsl:when test="count(.//text_ref) > 1">
  112.           MAJOR TREATMENT <xsl:call-template name="multi_ref"/>
  113.         </xsl:when>
  114.         <xsl:otherwise>
  115.         <xsl:call-template name="text_link">
  116.           <xsl:with-param name="articleId">
  117.               <xsl:value-of select=".//text_ref/@artclid"/>
  118.           </xsl:with-param>          
  119.           <xsl:with-param name="tocId">
  120.             <xsl:value-of select=".//text_ref/@tocid"/>
  121.           </xsl:with-param>
  122.           <xsl:with-param name="body">
  123.             MAJOR TREATMENT
  124.           </xsl:with-param>
  125.         </xsl:call-template>
  126.       </xsl:otherwise>
  127.       </xsl:choose>
  128.       </li>
  129.     </xsl:if>
  130.   </xsl:template>
  131.  
  132.   <xsl:template match="stats">
  133.     <li>
  134.     <xsl:call-template name="text_link">
  135.       <xsl:with-param name="articleId"><xsl:value-of select="flag/text_ref/@artclid"/></xsl:with-param>
  136.       <xsl:with-param name="tocId"><xsl:value-of select="flag/text_ref/@tocid"/></xsl:with-param>
  137.       <xsl:with-param name="body">STATISTICAL INFORMATION</xsl:with-param>
  138.     </xsl:call-template>
  139.     </li>
  140.   </xsl:template>
  141.  
  142.   <xsl:template match="flag">
  143.     <li><xsl:call-template name="ref"/></li>
  144.   </xsl:template>
  145.  
  146.   <xsl:template name="ref">
  147.  
  148.     <xsl:choose>
  149.       <xsl:when test="count(text_ref | assembly_ref | binary_ref | index_ref) = 0">
  150.         <xsl:call-template name="no_ref"/>
  151.       </xsl:when>
  152.       <xsl:when test="count(text_ref | assembly_ref | binary_ref | index_ref) = 1">
  153.         <xsl:apply-templates select="flag_text | umbrella_text" mode="one_ref"/>
  154.       </xsl:when>
  155.       <xsl:otherwise>
  156.         <xsl:apply-templates select="flag_text | umbrella_text"/><xsl:text disable-output-escaping='yes'>&nbsp;</xsl:text><xsl:call-template name="multi_ref"/>
  157.       </xsl:otherwise>
  158.     </xsl:choose>
  159.   </xsl:template>
  160.  
  161.   <xsl:template name="no_ref">
  162.     <xsl:apply-templates select="flag_text | umbrella_text"/>
  163.   </xsl:template>
  164.  
  165.   <!-- all refs except index ref are format "Flag (Ref 1, Ref2, ...)"
  166.        index refs are format "Flag: See Ref 1, Ref2, ..." -->
  167.   <xsl:template name="multi_ref">
  168.   
  169.       <xsl:choose>
  170.         <xsl:when test="text_ref">
  171.           (<xsl:apply-templates select="text_ref" mode="multi_ref"/>)
  172.         </xsl:when>
  173.         <xsl:when test="binary_ref">
  174.           (<xsl:apply-templates select="binary_ref" mode="multi_ref"/>)
  175.         </xsl:when>
  176.         <xsl:when test="assembly_ref">
  177.           (<xsl:apply-templates select="assembly_ref" mode="multi_ref"/>)
  178.         </xsl:when>
  179.         
  180.         <xsl:when test="index_ref">: See <xsl:apply-templates select="index_ref" mode="multi_ref"/></xsl:when>
  181.         
  182.       </xsl:choose>
  183.   </xsl:template>
  184.  
  185.   <xsl:template match="text_ref" mode="multi_ref">
  186.     <span style="font-weight: normal; font-style: italic;">in</span> <xsl:call-template name="text_link">
  187.       <xsl:with-param name="articleId"><xsl:value-of select="@artclid"/></xsl:with-param>
  188.       <xsl:with-param name="tocId"><xsl:value-of select="@tocid"/></xsl:with-param>
  189.       <xsl:with-param name="hook"><xsl:value-of select="@hook"/></xsl:with-param>
  190.     </xsl:call-template>
  191.     <xsl:if test="position() != last()">; </xsl:if>
  192.   </xsl:template>
  193.  
  194.   <xsl:template match="ref_toc_title">: <span style="font-weight: normal; font-style: normal;"><xsl:apply-templates/></span>
  195.   </xsl:template>
  196.  
  197.   <xsl:template match="text_ref/ref_artcl_title"> <span style="font-weight: normal; font-style: normal;"><xsl:value-of select="."/><xsl:apply-templates select="ref_toc_title"/></span></xsl:template>
  198.   
  199.   <xsl:template match="binary_ref" mode="multi_ref">
  200.     <xsl:call-template name="binary_link">
  201.       <xsl:with-param name="id"><xsl:value-of select="@id"/></xsl:with-param>
  202.       <xsl:with-param name="body">Image <xsl:value-of select="position()"/></xsl:with-param>
  203.     </xsl:call-template>
  204.     <xsl:if test="position() != last()">, </xsl:if>
  205.   </xsl:template>
  206.  
  207.   <xsl:template match="assembly_ref" mode="multi_ref">
  208.     <xsl:call-template name="assembly_link">
  209.       <xsl:with-param name="id"><xsl:value-of select="@id"/></xsl:with-param>
  210.       <xsl:with-param name="body">Image <xsl:value-of select="position()"/></xsl:with-param>
  211.     </xsl:call-template>
  212.     <xsl:if test="position() != last()">, </xsl:if>
  213.   </xsl:template>
  214.  
  215.   <xsl:template match="index_ref" mode="multi_ref">
  216.       <xsl:call-template name="index_link">
  217.         <xsl:with-param name="id">
  218.           <xsl:value-of select="@id"/>
  219.         </xsl:with-param>
  220.       </xsl:call-template>
  221.     <xsl:if test="position() != last()">, </xsl:if>
  222.   </xsl:template>
  223.  
  224.   <xsl:template match="umbrella">
  225.     <xsl:choose>
  226.       <xsl:when test="@display='horizontal'">
  227.         <li>
  228.           <xsl:call-template name="ref"/><xsl:text> </xsl:text>
  229.           <xsl:apply-templates select="flag" mode="horizontal_flag"/>
  230.         </li>
  231.       </xsl:when>
  232.       <xsl:otherwise>
  233.         <li><b><i><xsl:call-template name="ref"/></i></b></li>
  234.         <ul><xsl:apply-templates select="umbrella | flag"/></ul>       
  235.       </xsl:otherwise>
  236.     </xsl:choose> 
  237.   </xsl:template>
  238.   
  239.   <xsl:template match="flag" mode="horizontal_flag">
  240.     <xsl:if test="position() > 1">, </xsl:if><xsl:call-template name="ref"/>
  241.   </xsl:template>
  242.  
  243.   <xsl:template match="flag_text | umbrella_text" mode="one_ref">
  244.     <xsl:choose>
  245.  
  246.     <xsl:when test="../text_ref">
  247.       <xsl:call-template name="text_link">
  248.         <xsl:with-param name="articleId"><xsl:value-of select="../text_ref/@artclid"/></xsl:with-param>
  249.         <xsl:with-param name="tocid"><xsl:value-of select="../text_ref/@tocid"/></xsl:with-param>
  250.         <xsl:with-param name="hook"><xsl:value-of select="../text_ref/@hook"/></xsl:with-param>
  251.         <xsl:with-param name="urltitle"><xsl:value-of select="../text_ref/@urltitle"/></xsl:with-param>
  252.       </xsl:call-template>
  253.     </xsl:when>
  254.  
  255.     <xsl:when test="../assembly_ref">
  256.       <xsl:call-template name="assembly_link">
  257.         <xsl:with-param name="id"><xsl:value-of select="../assembly_ref/@id"/></xsl:with-param>
  258.       </xsl:call-template>
  259.     </xsl:when>
  260.  
  261.     <xsl:when test="../binary_ref">
  262.       <xsl:call-template name="binary_link">
  263.         <xsl:with-param name="id"><xsl:value-of select="../binary_ref/@id"/></xsl:with-param>
  264.       </xsl:call-template>
  265.     </xsl:when>
  266.  
  267.     <xsl:when test="../index_ref">
  268.      <xsl:choose>
  269.       <xsl:when test="ancestor::see_also">
  270.       <xsl:call-template name="index_link">
  271.         <xsl:with-param name="id">
  272.           <xsl:value-of select="../index_ref/@id"/>
  273.         </xsl:with-param>
  274.         <xsl:with-param name="body">
  275.           <xsl:value-of select="../index_ref"/>
  276.         </xsl:with-param>
  277.       </xsl:call-template>
  278.       </xsl:when>
  279.       <xsl:otherwise>
  280.       <xsl:apply-templates/>: See
  281.       <xsl:call-template name="index_link">
  282.         <xsl:with-param name="id">
  283.           <xsl:value-of select="../index_ref/@id"/>
  284.         </xsl:with-param>
  285.         <xsl:with-param name="body">
  286.           <xsl:apply-templates select="../index_ref"/>
  287.         </xsl:with-param>
  288.       </xsl:call-template>
  289.       </xsl:otherwise>
  290.       </xsl:choose>      
  291.     </xsl:when>
  292.  
  293.     </xsl:choose>
  294.   </xsl:template>
  295.   
  296.   
  297.   <xsl:template match="charundef">
  298.         <xsl:value-of select="@char"/>
  299.     </xsl:template>
  300.     
  301.     <xsl:template match="charemph">
  302.     <xsl:choose>
  303.       <xsl:when test="@ty='i'"><i><xsl:value-of select="@char"/></i></xsl:when>
  304.       <xsl:when test="@ty='s'"><font size="-1" class="smallText"><xsl:value-of select="@char"/></font></xsl:when>
  305.       <xsl:when test="@ty='b'"><b><xsl:value-of select="@char"/></b></xsl:when>
  306.       <xsl:when test="@ty='bi'"><b><i><xsl:value-of select="@char"/></i></b></xsl:when>
  307.     </xsl:choose>
  308.       </xsl:template>
  309.     
  310.     <xsl:template match="charfont">
  311.         <font face="{@font}"><xsl:value-of select="@char"/></font>
  312.       </xsl:template>
  313.  
  314. </xsl:stylesheet>  
  315.