home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / simple2page.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.3 KB  |  126 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  18.   <xsl:param name="locale"/>
  19.   <xsl:param name="page"/>
  20.  
  21.   <xsl:template match="root">
  22.     <document>
  23.       <header>
  24.         <title>Internationalization (i18n) and Localization (l10n)</title>
  25.       </header>
  26.       <body>
  27.         <row>
  28.           <column title="Menu">
  29.             <xsl:apply-templates select="book"/>
  30.           </column>
  31.           <column title="{document/title}">
  32.             <xsl:apply-templates select="document"/>
  33.           </column>
  34.         </row>
  35.       </body>
  36.     </document>
  37.   </xsl:template>
  38.  
  39.   <xsl:template match="document">
  40.     <h2>
  41.       <font color="navy">
  42.         <xsl:value-of select="title"/>
  43.       </font>
  44.       <xsl:apply-templates select="form"/>
  45.     </h2>
  46.     <h5>
  47.       <xsl:value-of select="sub-title"/>
  48.     </h5>
  49.     <hr align="left" noshade="noshade" size="1"/>
  50.     <small>
  51.       <font color="red">
  52.         <i>
  53.           <xsl:apply-templates select="annotation"/>
  54.         </i>
  55.       </font>
  56.     </small>
  57.     <xsl:apply-templates select="content"/>
  58.     <hr align="left" noshade="noshade" size="1"/>
  59.     <xsl:apply-templates select="bottom"/>
  60.   </xsl:template>
  61.  
  62.   <xsl:template match="book">
  63.     <xsl:apply-templates select="menu"/>
  64.   </xsl:template>
  65.  
  66.   <xsl:template match="para">
  67.     <p>
  68.       <font color="navy">
  69.         <b>
  70.           <xsl:number format="0. "/>
  71.           <xsl:value-of select="@name"/>
  72.         </b>
  73.         <xsl:text> </xsl:text>
  74.         <xsl:value-of select="@title"/>
  75.       </font>
  76.       <br/>
  77.       <xsl:apply-templates select="text() | strong | i"/>
  78.     </p>
  79.   </xsl:template>
  80.  
  81.   <!-- Current (open) menu -->
  82.   <xsl:template match="menu">
  83.     <xsl:if test="@icon">
  84.       <img src="{@icon}" align="middle"/>
  85.       <xsl:text> </xsl:text>
  86.     </xsl:if>
  87.     <h3>
  88.       <xsl:value-of select="@label"/>
  89.     </h3>
  90.     <ul>
  91.       <xsl:apply-templates/>
  92.     </ul>
  93.   </xsl:template>
  94.  
  95.   <!-- Display a link to a page -->
  96.   <xsl:template match="menu-item[substring-after(@href, 'locale=') = $locale or @href=$page or (@href='' and $locale='')]">
  97.     <li class="current" title="{@href}">
  98.       <xsl:if test="@icon">
  99.         <img src="{@icon}" align="middle"/>
  100.         <xsl:text> </xsl:text>
  101.       </xsl:if>
  102.       <xsl:value-of select="@label"/>
  103.     </li>
  104.   </xsl:template>
  105.  
  106.   <xsl:template match="menu-item | external">
  107.     <li class="page">
  108.       <xsl:if test="@icon">
  109.         <img src="{@icon}" align="middle"/>
  110.         <xsl:text> </xsl:text>
  111.       </xsl:if>
  112.       <a href="{@href}" class="page">
  113.         <xsl:value-of select="@label"/>
  114.       </a>
  115.     </li>
  116.   </xsl:template>
  117.  
  118.   <xsl:template match="node()|@*" priority="-1">
  119.     <xsl:copy>
  120.       <xsl:apply-templates select="@*"/>
  121.       <xsl:apply-templates/>
  122.     </xsl:copy>
  123.   </xsl:template>
  124.  
  125. </xsl:stylesheet>
  126.