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 / svg-samples2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  5.2 KB  |  164 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" xmlns:xlink="http://www.w3.org/1999/xlink">
  19.  
  20.  <xsl:template match="/">
  21.   <html>
  22.    <head>
  23.     <title>Apache Cocoon @version@</title>
  24.    </head>
  25.    <body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75">
  26.     <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
  27.      <tr>
  28.       <td colspan="3" align="center"><font face="arial,helvetica,sanserif" color="#000000">The Apache Software Foundation is proud to present...</font></td>
  29.      </tr>
  30.      <tr>
  31.       <td width="30%"></td>
  32.       <td width="40%" align="center"><img border="0" src="images/cocoon.gif"/></td>
  33.       <td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version @version@</b></font></td>
  34.      </tr>
  35.     </table>
  36.  
  37.     <xsl:apply-templates/>
  38.  
  39.     <p align="center">
  40.      <font size="-1">
  41.       Copyright © @year@ <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/>
  42.       All rights reserved.
  43.      </font>
  44.     </p>
  45.    </body>
  46.   </html>
  47.  </xsl:template>
  48.  
  49.  <xsl:template name="generate-group-heading">
  50.      <xsl:param name="position"/>
  51.     <svg:svg width="200" height="15" xmlns:svg="http://www.w3.org/2000/svg">
  52.         <xsl:choose>
  53.             <xsl:when test="$position = 'left'">
  54.                 <svg:g style="stroke: black; stroke-width: 2px;">
  55.                     <svg:line x1="5" y1="5" x2="8" y2="5"/>
  56.                     <svg:line x1="5" y1="5" x2="5" y2="15"/>
  57.                 </svg:g>
  58.                 <svg:text x="10px" y="11px" style="font-family:sans; font-size:15px; fill: #0086b2; text-anchor:start;">
  59.                     <xsl:value-of select="@name"/>
  60.                 </svg:text>
  61.             </xsl:when>
  62.             <xsl:otherwise>
  63.                 <svg:g style="stroke: black; stroke-width: 2px;">
  64.                     <svg:line x1="195" y1="5" x2="192" y2="5"/>
  65.                     <svg:line x1="195" y1="5" x2="195" y2="15"/>
  66.                 </svg:g>
  67.                 <svg:text x="190px" y="11px" style="font-family:sans; font-size:15px; fill: #0086b2; text-anchor:end;">
  68.                     <xsl:value-of select="@name"/>
  69.                 </svg:text>
  70.             </xsl:otherwise>
  71.         </xsl:choose>
  72.     </svg:svg>
  73.  </xsl:template>
  74.  
  75.  <xsl:template name="generate-item">
  76.      <xsl:param name="position"/>
  77.     <svg:svg width="200" height="15" xmlns:svg="http://www.w3.org/2000/svg">
  78.         <xsl:choose>
  79.             <xsl:when test="$position = 'left'">
  80.                 <svg:g style="stroke: black; stroke-width: 2px;">
  81.                     <xsl:choose>
  82.                         <xsl:when test="position() = last()">
  83.                             <svg:line x1="5" y1="-1" x2="5" y2="5"/>
  84.                         </xsl:when>
  85.                         <xsl:otherwise>
  86.                             <svg:line x1="5" y1="-1" x2="5" y2="15"/>
  87.                         </xsl:otherwise>
  88.                     </xsl:choose>
  89.                     <svg:line x1="5" y1="5" x2="18" y2="5"/>
  90.                 </svg:g>
  91.                 <svg:text x="20px" y="11px" style="font-family:sans; font-size:15px; fill: black; text-anchor:start;"> 
  92.                     <xsl:value-of select="@name"/>
  93.                 </svg:text>
  94.             </xsl:when>
  95.             <xsl:otherwise>
  96.                 <svg:g style="stroke: black; stroke-width: 2px;">
  97.                     <xsl:choose>
  98.                         <xsl:when test="position() = last()">
  99.                             <svg:line x1="195" y1="-1" x2="195" y2="5"/>
  100.                         </xsl:when>
  101.                         <xsl:otherwise>
  102.                             <svg:line x1="195" y1="-1" x2="195" y2="15"/>
  103.                         </xsl:otherwise>
  104.                     </xsl:choose>
  105.                     <svg:line x1="195" y1="5" x2="182" y2="5"/>
  106.                 </svg:g>
  107.                 <svg:text x="180px" y="11px" style="font-family:sans; font-size:15px; fill: black; text-anchor:end;"> 
  108.                     <xsl:value-of select="@name"/>
  109.                 </svg:text>
  110.             </xsl:otherwise>
  111.         </xsl:choose>
  112.     </svg:svg>
  113.  </xsl:template>
  114.  
  115.  <xsl:template name="generate-group">
  116.      <xsl:param name="position"/>
  117.     <tr>
  118.         <td>
  119.             <xsl:call-template name="generate-group-heading">
  120.                 <xsl:with-param name="position" select="$position"/>
  121.             </xsl:call-template>
  122.         </td>
  123.     </tr>
  124.     <xsl:for-each select="sample">
  125.         <tr>
  126.             <td>
  127.                 <a href="{@href}">
  128.                     <xsl:call-template name="generate-item">
  129.                         <xsl:with-param name="position" select="$position"/>
  130.                     </xsl:call-template>
  131.                 </a>
  132.             </td>
  133.         </tr>
  134.     </xsl:for-each>
  135.  </xsl:template>
  136.  
  137.  <xsl:template match="samples">
  138.      <xsl:variable name="half" select="round(count(group) div 2)"/>
  139.      <table cellspacing="0" cellpadding="0" border="0" align="center">
  140.         <tr>
  141.             <td valign="top">
  142.                 <table cellspacing="0" cellpadding="0" border="0">
  143.                     <xsl:for-each select="group[position() <= $half]">
  144.                         <xsl:call-template name="generate-group">
  145.                             <xsl:with-param name="position">left</xsl:with-param>
  146.                         </xsl:call-template>
  147.                     </xsl:for-each>
  148.                 </table>
  149.             </td>
  150.             <td valign="top">
  151.                 <table cellspacing="0" cellpadding="0" border="0">
  152.                     <xsl:for-each select="group[position() > $half]">
  153.                         <xsl:call-template name="generate-group">
  154.                             <xsl:with-param name="position">right</xsl:with-param>
  155.                         </xsl:call-template>
  156.                     </xsl:for-each>
  157.                 </table>
  158.             </td>
  159.         </tr>
  160.     </table>
  161.  </xsl:template>
  162.  
  163. </xsl:stylesheet>
  164.