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 / site2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  4.6 KB  |  174 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. <!--
  19.   Version <![CDATA[ $Id: site2html.xsl,v 1.3 2004/04/05 12:25:32 antonio Exp $ ]]>
  20.   
  21.   Transformation of an aggregated site document to html
  22. -->
  23.  
  24. <xsl:stylesheet version="1.0" 
  25.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  26.   xmlns:page="http://apache.org/cocoon/paginate/1.0"
  27.  
  28.   exclude-result-prefixes="page"
  29. >
  30.  
  31. <xsl:template match="site">
  32.   <!--xsl:copy-of select="."/-->
  33.  
  34. <html>
  35.   <head>
  36.     <title><xsl:value-of select="/site/mid-col-2/header/title"/></title>
  37.     <meta name="keywords" content="Cocoon, Java, IMAP, SMTP, XML, XSL, XSLT, MultiChannel, publishing"/>
  38.     <meta name="description" content="A site mail access via Cocoon."
  39.     />
  40.     <link rel="stylesheet" type="text/css" media="screen" title="" href="main.css"/>
  41.     <link rel="icon" href="favicon.ico"/>
  42.   </head>
  43.   <body>
  44.     <div id="top-section">
  45.       <div id="top-col-1">
  46.         <xsl:apply-templates select="/site/top-col-1/*"/>
  47.       </div>
  48.     </div>
  49.  
  50.     <div id="head-sectin">
  51.       <div id="head-col-1">
  52.         <xsl:apply-templates select="/site/head-col-1/*"/>
  53.       </div>
  54.     </div>
  55.     
  56.     <div id="mid-section">
  57.       <div id="mid-col-1">
  58.         <xsl:apply-templates select="/site/mid-col-1/*"/>
  59.       </div>
  60.       <div id="mid-col-2">
  61.         <xsl:apply-templates select="/site/mid-col-2/*"/>
  62.  
  63.         <br/>
  64.         <xsl:apply-templates select="/site/page:page"/>
  65.         
  66.         <br/>
  67.         <xsl:apply-templates select="/site/bottom-col-1/*"/>
  68.  
  69.       </div>
  70.       <div id="mid-col-3">
  71.         <xsl:apply-templates select="/site/mid-col-3/*"/>
  72.       </div>
  73.     </div>
  74.   </body>
  75. </html>
  76. </xsl:template>
  77.  
  78. <xsl:template match="header">
  79. </xsl:template>
  80.  
  81. <xsl:template match="body">
  82.   <xsl:apply-templates/>
  83. </xsl:template>
  84.  
  85. <xsl:template match="s1">
  86.   <h1><xsl:value-of select="@title"/></h1>
  87.   <xsl:apply-templates/>
  88. </xsl:template>
  89.  
  90. <xsl:template match="s2">
  91.   <h2><xsl:value-of select="@title"/></h2>
  92.   <xsl:apply-templates/>
  93. </xsl:template>
  94.  
  95. <xsl:template match="s3">
  96.   <h3><xsl:value-of select="@title"/></h3>
  97.   <xsl:apply-templates/>
  98. </xsl:template>
  99.  
  100. <xsl:template match="source">
  101.   <pre><code><xsl:value-of select="."/></code></pre>
  102. </xsl:template>
  103.  
  104. <xsl:template match="figure">
  105.   <p align="center">
  106.     <xsl:choose>
  107.       <xsl:when test="string(@width) and string(@height)">
  108.         <img src="{@src}" alt="{@alt}" width="{@width}" height="{@height}" border="0" vspace="4" hspace="4"/>
  109.       </xsl:when>
  110.       <xsl:otherwise>
  111.         <img src="{@src}" alt="{@alt}" border="0" vspace="4" hspace="4"/>
  112.       </xsl:otherwise>
  113.     </xsl:choose>
  114.   </p>
  115. </xsl:template>
  116. <xsl:template match="img">
  117.   <img src="{@src}" alt="{@alt}" border="0" vspace="4" hspace="4" align="right"/>
  118. </xsl:template>
  119. <xsl:template match="icon">
  120.   <img src="{@src}" alt="{@alt}" border="0" align="absmiddle"/>
  121. </xsl:template>
  122.  
  123. <xsl:template match="link">
  124.   <a href="{@href}">
  125.     <xsl:apply-templates/>
  126.   </a>
  127. </xsl:template>
  128.  
  129. <xsl:template match="jump">
  130.   <a href="{@href}#{@anchor}">
  131.     <xsl:apply-templates/>
  132.   </a>
  133. </xsl:template>
  134.  
  135. <xsl:template match="anchor">
  136.   <a name="{@id}"/>
  137. </xsl:template>
  138.  
  139. <xsl:template match="page:page">
  140.  
  141.   <div class="row">
  142.     <span class="left">
  143.       <xsl:for-each select="page:range-link[@type='prev']">
  144.         [<a href="{@uri}"> <xsl:value-of select="@page"/> </a>]
  145.       </xsl:for-each>
  146.       
  147.       <xsl:for-each select="page:link[@type='prev']">
  148.         [<a href="{@uri}"> <xsl:value-of select="@page"/> </a>]
  149.       </xsl:for-each>
  150.     </span>
  151.     <span class ="right">
  152.       <xsl:for-each select="page:link[@type='next']">
  153.         [<a href="{@uri}"> <xsl:value-of select="@page"/> </a>]
  154.       </xsl:for-each>
  155.       <xsl:for-each select="page:range-link[@type='next']">
  156.         [<a href="{@uri}"><xsl:value-of select="@page"/></a>]
  157.       </xsl:for-each>
  158.     </span>
  159.   </div>
  160.   <div class="spacer"/>
  161.   <div class="row" align="center">
  162.     <xsl:value-of select="@current"/> / <xsl:value-of select="@total"/> 
  163.   </div>
  164. </xsl:template>
  165.  
  166.  
  167. <xsl:template match="@*|*|text()" priority="-1">
  168.   <xsl:copy>
  169.     <xsl:apply-templates select="@*|*|text()"/>
  170.   </xsl:copy>
  171. </xsl:template>
  172.  
  173. </xsl:stylesheet>
  174.