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 / navigation.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  4.3 KB  |  146 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.  
  18. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  19.  
  20.   <xsl:param name="section"/>
  21.   <xsl:param name="slide"/>
  22.  
  23.   <xsl:template match="slides">
  24.  
  25.    <slide style="{@style}">
  26.      <xsl:if test="not($section)">
  27.        <title>
  28.         <xsl:value-of select="title"/>
  29.        </title>
  30.        <navigation>
  31.         <next href="./slides?section=1"/>
  32.        </navigation>
  33.        <layout>
  34.         <title><a href="./slides?section=1"><xsl:value-of select="title"/></a></title>
  35.         <subtitle>
  36.          <xsl:for-each select="authors/person">
  37.           <xsl:value-of select="name"/>
  38.            <xsl:text> (</xsl:text>
  39.            <xsl:value-of select="email"/>
  40.            <xsl:text>)</xsl:text>
  41.           </xsl:for-each>
  42.         </subtitle>
  43.         <quote><xsl:value-of select="overview"/></quote>
  44.        </layout>
  45.      </xsl:if>
  46.  
  47.      <xsl:if test="$section">
  48.       <xsl:if test="not($slide)">
  49.        <xsl:apply-templates select="//section[position() = $section]"/>
  50.       </xsl:if>
  51.       <xsl:if test="$slide">
  52.        <xsl:apply-templates select="//section[position() = $section]/slide[position() = $slide]"/>
  53.       </xsl:if>
  54.      </xsl:if>
  55.    </slide>
  56.   </xsl:template>
  57.  
  58. <!-- ================================ Section ============================== -->
  59.  
  60.   <xsl:template match="section">
  61.     <title>
  62.      <xsl:value-of select="title"/>
  63.     </title>
  64.  
  65.     <navigation>
  66.      <xsl:variable name="last">
  67.       <xsl:value-of select="count(//section)"/>
  68.      </xsl:variable>
  69.      <xsl:variable name="previous-last">
  70.       <xsl:value-of select="count(//section[position() = ($section - 1)]/slide)"/>
  71.      </xsl:variable>
  72.  
  73.      <home href="./slides"/>
  74.  
  75.      <xsl:if test="$section!=1">
  76.       <previous-section href="./slides?section={$section - 1}"/>
  77.       <previous href="./slides?section={$section - 1}&slide={$previous-last}"/>
  78.      </xsl:if>
  79.  
  80.      <xsl:if test="$section!=$last">
  81.       <next-section href="./slides?section={$section + 1}"/>
  82.      </xsl:if>
  83.  
  84.      <next href="./slides?section={$section}&slide=1"/>
  85.     </navigation>
  86.  
  87.     <layout>
  88.      <title><xsl:value-of select="title"/></title>
  89.      <subtitle><xsl:value-of select="subtitle"/></subtitle>
  90.     </layout>
  91.   </xsl:template>
  92.  
  93. <!-- ================================ Slide ============================== -->
  94.  
  95.   <xsl:template match="slide">
  96.     <title>
  97.      <xsl:value-of select="title"/>
  98.     </title>
  99.  
  100.     <navigation>
  101.      <xsl:variable name="last-section">
  102.       <xsl:value-of select="count(//section)"/>
  103.      </xsl:variable>
  104.      <xsl:variable name="last">
  105.       <xsl:value-of select="count(//section[position() = $section]/slide)"/>
  106.      </xsl:variable>
  107.      <xsl:variable name="previous-last">
  108.       <xsl:value-of select="count(//section[position() = ($section - 1)]/slide)"/>
  109.      </xsl:variable>
  110.  
  111.      <home href="./slides?section={$section}"/>
  112.  
  113.      <xsl:if test="$slide!=1">
  114.       <previous href="./slides?section={$section}&slide={$slide - 1}"/>
  115.      </xsl:if>
  116.      <xsl:if test="($slide=1)">
  117.       <previous href="./slides?section={$section}"/>
  118.      </xsl:if>
  119.  
  120.      <xsl:if test="$slide!=$last">
  121.       <next href="./slides?section={$section}&slide={$slide + 1}"/>
  122.      </xsl:if>
  123.      <xsl:if test="($slide=$last) and ($section!=$last-section)">
  124.       <next href="./slides?section={$section + 1}"/>
  125.      </xsl:if>
  126.  
  127.      <xsl:if test="$section!=1">
  128.       <previous-section href="./slides?section={$section - 1}"/>
  129.      </xsl:if>
  130.      <xsl:if test="$section!=$last-section">
  131.       <next-section href="./slides?section={$section + 1}"/>
  132.      </xsl:if>
  133.     </navigation>
  134.  
  135.     <layout>
  136.      <xsl:apply-templates/>
  137.     </layout>
  138.   </xsl:template>
  139.  
  140.   <xsl:template match="*|@*|text()">
  141.    <xsl:copy>
  142.     <xsl:apply-templates select="*|@*|text()"/>
  143.    </xsl:copy>
  144.   </xsl:template>
  145.  
  146. </xsl:stylesheet>