home *** CD-ROM | disk | FTP | other *** search
/ Encyclopaedia Britannica …oncise Encyclopedia 2007 / bcd_concise07.iso / data / jars / CdAtlasLib.jar / AtlasStatisticsFootnote.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2006-06-20  |  5.7 KB  |  144 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE xsl:stylesheet [
  3.   <!ENTITY % default.oec.entities SYSTEM "http://www.britannica.com/entities/oec/default">
  4.   %default.oec.entities;
  5. ]>
  6.  
  7. <xsl:stylesheet
  8.        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9.        xmlns:html="http://www.w3.org/TR/html4/loose.dtd"
  10.        xmlns:xhtml="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  11.        exclude-result-prefixes="html xhtml"
  12.        version="1.0">
  13.  
  14. <xsl:output method="xhtml" omit-xml-declaration="yes" indent="yes" encoding="UTF-8"/>
  15.  
  16. <!-- default to show nodes unless another template overrides -->
  17. <xsl:template match="text()|@*"/>
  18.  
  19. <!-- Document Root -->
  20. <xsl:template match="/">
  21.     <html>
  22.     <head></head>
  23.     <body leftmargin="0" rightmargin="0">
  24.         <table width="110" border="0">
  25.             <xsl:for-each select="atlasFacts/fact">
  26.                 <xsl:call-template name="displayName"/>
  27.             </xsl:for-each>
  28.         </table>
  29.         <xsl:if test="count(descendant::footnote) > 0"> 
  30.            <hr></hr>
  31.             <table width="110" border="0">
  32.                 <xsl:for-each select="(descendant::fact)">
  33.                     <xsl:apply-templates select="footnote" mode="summary"/>
  34.                 </xsl:for-each>
  35.             </table>
  36.         </xsl:if>
  37.     </body>
  38.     </html>
  39. </xsl:template>
  40.  
  41.  <xsl:template name="displayName"> 
  42.         <xsl:choose> 
  43.             <xsl:when test="displayName='GNP PER CAPITA IN NOMINAL U.S.$'">
  44.               <xsl:call-template name="profileEntry">
  45.                 <xsl:with-param name="viewedName">GNP per capita in nominal U.S. $</xsl:with-param>
  46.               </xsl:call-template>
  47.             </xsl:when>
  48.             <xsl:when test="starts-with(displayName, 'ANNUAL ELECTRICITY PRODUCTION (')">
  49.               <xsl:call-template name="profileEntry">
  50.                 <xsl:with-param name="viewedName">
  51.                   <xsl:text disable-output-escaping="yes">
  52.                     Annual electricity production in millions KW-HR
  53.                   </xsl:text>
  54.                </xsl:with-param>
  55.               </xsl:call-template>
  56.             </xsl:when>
  57.             <xsl:when test="starts-with(displayName, 'TOTAL MILITARY EXPENDITURE (')">
  58.               <xsl:call-template name="profileEntry">
  59.                 <xsl:with-param name="viewedName">
  60.                   <xsl:text disable-output-escaping="yes">
  61.                     Total military expenditure in millions U.S.$
  62.                   </xsl:text>
  63.                </xsl:with-param>
  64.               </xsl:call-template>
  65.             </xsl:when>
  66.         <!-- oceans -->
  67.         <xsl:when test="displayName='AREA (000,000 SQ MI)'">
  68.               <xsl:call-template name="profileEntry">
  69.                 <xsl:with-param name="viewedName">Area (in millions sq mi)</xsl:with-param>
  70.               </xsl:call-template>
  71.             </xsl:when>
  72.         <xsl:when test="displayName='AREA (000,000 SQ KM)'">
  73.               <xsl:call-template name="profileEntry">
  74.                 <xsl:with-param name="viewedName">Area (in millions sq km)</xsl:with-param>
  75.               </xsl:call-template>
  76.             </xsl:when>
  77.         <xsl:when test="displayName='VOLUME (000,000 CU MI)'">
  78.               <xsl:call-template name="profileEntry">
  79.                 <xsl:with-param name="viewedName">Volume (in millions cu mi)</xsl:with-param>
  80.               </xsl:call-template>
  81.             </xsl:when>
  82.        <xsl:when test="displayName='VOLUME (000,000 CU KM)'">
  83.               <xsl:call-template name="profileEntry">
  84.                 <xsl:with-param name="viewedName">Volume (in millions cu km)</xsl:with-param>
  85.               </xsl:call-template>
  86.             </xsl:when>
  87.        <xsl:when test="displayName='MAXIMUM DEPTH (FT)'">
  88.               <xsl:call-template name="profileEntry">
  89.                 <xsl:with-param name="viewedName">Maximum depth (ft)</xsl:with-param>
  90.               </xsl:call-template>
  91.             </xsl:when>
  92.        <xsl:when test="displayName='MAXIMUM DEPTH (M)'">
  93.               <xsl:call-template name="profileEntry">
  94.                 <xsl:with-param name="viewedName">Maximum depth (m)</xsl:with-param>
  95.               </xsl:call-template>
  96.             </xsl:when>
  97.            <xsl:otherwise>
  98.              <xsl:call-template name="profileEntry">
  99.                <xsl:with-param name="viewedName"><xsl:value-of select="displayName"/></xsl:with-param>
  100.              </xsl:call-template>
  101.           </xsl:otherwise>
  102.       </xsl:choose>
  103. </xsl:template> 
  104.  
  105.  <xsl:template name="profileEntry">
  106. <xsl:param name="viewedName"/>
  107. <tr border="0" >
  108.   <td align="right" width="60" border="0">
  109.       <b><i><font size="10"><xsl:value-of select="$viewedName"/>
  110.       <xsl:if test="number(displayValue/@yearLow) > 0">(<xsl:value-of select="displayValue/@yearLow"/><xsl:if test="number(displayValue/@yearHigh) > 0">-<xsl:value-of select="displayValue/@yearHigh"/></xsl:if>)</xsl:if>
  111.       <xsl:apply-templates select="footnote" mode="count" /></font></i></b></td>
  112.   <td valign="bottom" align="left" width="50" border="0">
  113.    <xsl:choose>
  114.      <xsl:when test="displayValue=0">
  115.        <font size="10">
  116.         <xsl:text>—</xsl:text>
  117.        </font>
  118.      </xsl:when>
  119.      <xsl:otherwise>
  120.       <font size="10">
  121.         <xsl:value-of select="format-number(displayValue, '###,##0.###')"/> 
  122.       </font>
  123.      </xsl:otherwise>
  124.    </xsl:choose>
  125.    </td> 
  126.      
  127. </tr>
  128. </xsl:template> 
  129.  
  130.  <xsl:template match="footnote" mode="count">    
  131.     <xsl:text>(</xsl:text>
  132.     <xsl:value-of select="count(preceding::footnote) + 1"/>
  133.     <xsl:text>)</xsl:text>
  134. </xsl:template>
  135.  
  136. <xsl:template match="footnote" mode="summary"> 
  137.         <tr>
  138.         <td width="10" border="0"><font size="10"><xsl:value-of select="count(preceding::footnote) + 1"/><xsl:text>)</xsl:text></font></td>
  139.         <td width="140" border="0"><font size="10"><xsl:value-of select="(descendant-or-self::footnote)"/></font></td>
  140.         </tr>
  141. </xsl:template> 
  142.  
  143. </xsl:stylesheet>
  144.