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 / wiki2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  4.9 KB  |  187 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 version="1.0"
  18.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  19.                 xmlns:st="http://chaperon.sourceforge.net/schema/syntaxtree/2.0"
  20.                 xmlns="http://www.w3.org/1999/xhtml">
  21.  
  22.  <xsl:output indent="yes" method="html"/>
  23.  
  24. <!-- <xsl:template match="/">
  25.   <xsl:choose>
  26.    <xsl:when test="st:wiki">
  27.     <html>
  28.      <head>
  29.       <title>Wiki example</title>
  30.      </head>
  31.      <body>
  32.       <xsl:apply-templates select="st:wiki/st:paragraphs/st:paragraph"/>
  33.      </body>
  34.     </html>   
  35.    </xsl:when>
  36.    <xsl:otherwise>
  37.     <xsl:apply-templates/>
  38.    </xsl:otherwise>
  39.   </xsl:choose>
  40.  </xsl:template>-->
  41.  
  42.  <xsl:template match="//wiki">
  43.   <div style="background: #b9d3ee; border: thin; border-color: black; border-style: solid; padding-left: 0.8em; 
  44.                padding-right: 0.8em; padding-top: 0px; padding-bottom: 0px; margin: 0.5ex 0px; clear: both;">
  45.    <xsl:apply-templates select="paragraphs/paragraph"/>
  46.   </div>
  47.  </xsl:template>
  48.  
  49.  <xsl:template match="st:paragraph" >
  50.   <xsl:apply-templates select="st:bulletedlist|st:numberedlist1|st:numberedlist2|st:numberedlist3|st:headitem|st:footnote|st:textitem|st:LINE"/>
  51.  </xsl:template>
  52.  
  53.  <xsl:template match="st:textitem" >
  54.   <p>
  55.    <xsl:apply-templates select="st:firstblock|st:textblock"/>
  56.   </p>
  57.  </xsl:template>
  58.  
  59.  <xsl:template match="st:textblock" >
  60.   <xsl:apply-templates select="st:LINK|st:boldblock|st:italicblock|st:underlineblock|st:TEXT|st:note"/>
  61.  </xsl:template>
  62.  
  63.  <xsl:template match="st:firstblock" >
  64.   <xsl:apply-templates select="st:LINK|st:boldblock|st:italicblock|st:underlineblock|st:TEXT"/>
  65.  </xsl:template>
  66.  
  67.  <xsl:template match="st:LINE" >
  68.   <hr/>
  69.  </xsl:template>
  70.  
  71.  <xsl:template match="st:bulletedlist" >
  72.   <ul>
  73.    <xsl:apply-templates select="st:bulletedlistitem"/>
  74.   </ul>
  75.  </xsl:template>
  76.  
  77.  <xsl:template match="st:bulletedlistitem" >
  78.   <li>
  79.    <xsl:apply-templates select="st:textblock"/>
  80.   </li>
  81.  </xsl:template>
  82.  
  83.  <xsl:template match="st:numberedlist1" >
  84.   <ol>
  85.    <xsl:apply-templates select="st:numberedlistitem1|st:numberedlist2"/>
  86.   </ol>
  87.  </xsl:template>
  88.  
  89.  <xsl:template match="st:numberedlistitem1" >
  90.   <li>
  91.    <xsl:apply-templates select="st:textblock"/>
  92.   </li>
  93.  </xsl:template>
  94.  
  95.  <xsl:template match="st:numberedlist2" >
  96.   <ol>
  97.    <xsl:apply-templates select="st:numberedlistitem2|st:numberedlist3"/>
  98.   </ol>
  99.  </xsl:template>
  100.     
  101.  <xsl:template match="st:numberedlistitem2" >
  102.   <li>
  103.    <xsl:apply-templates select="st:textblock"/>
  104.   </li>
  105.  </xsl:template>
  106.  
  107.  <xsl:template match="st:numberedlist3" >
  108.   <ol>
  109.    <xsl:apply-templates select="st:numberedlistitem3"/>
  110.   </ol>
  111.  </xsl:template>
  112.     
  113.  <xsl:template match="st:numberedlistitem3" >
  114.   <li>
  115.    <xsl:apply-templates select="st:textblock"/>
  116.   </li>
  117.  </xsl:template>
  118.  
  119.  <xsl:template match="st:headitem" >
  120.   <xsl:choose>
  121.    <xsl:when test="string-length(st:HEAD)=2">
  122.     <h2>
  123.      <xsl:apply-templates select="st:textblock"/>
  124.     </h2>
  125.    </xsl:when>
  126.    <xsl:when test="string-length(st:HEAD)=3">
  127.     <h3>
  128.      <xsl:apply-templates select="st:textblock"/>
  129.     </h3>
  130.    </xsl:when>
  131.    <xsl:otherwise>
  132.     <h1>
  133.      <xsl:apply-templates select="st:textblock"/>
  134.     </h1>
  135.    </xsl:otherwise>
  136.   </xsl:choose>
  137.  </xsl:template>
  138.  
  139.  <xsl:template match="st:footnote" >
  140.   <a name="{normalize-space(st:note/st:TEXT|st:note/st:LINK)}">
  141.    [<xsl:apply-templates select="st:note/st:TEXT|st:note/st:LINK"/>]
  142.    <xsl:apply-templates select="st:textblock"/>
  143.   </a>
  144.  </xsl:template>
  145.  
  146.  <xsl:template match="st:LINK" >
  147.   <a href="{normalize-space(.)}">
  148.    <xsl:value-of select="."/>
  149.   </a>
  150.  </xsl:template>
  151.  
  152.  <xsl:template match="st:boldblock" >
  153.   <b>
  154.    <xsl:value-of select="st:TEXT"/>
  155.   </b>
  156.  </xsl:template>
  157.  
  158.  <xsl:template match="st:italicblock" >
  159.   <i>
  160.    <xsl:value-of select="st:TEXT"/>
  161.   </i>
  162.  </xsl:template>
  163.  
  164.  <xsl:template match="st:underlineblock" >
  165.   <u>
  166.    <xsl:value-of select="st:TEXT"/>
  167.   </u><xsl:text> </xsl:text>
  168.  </xsl:template>
  169.  
  170.  <xsl:template match="st:note" >
  171.   <a href="#{normalize-space(st:TEXT|st:LINK)}">
  172.    [<xsl:apply-templates select="st:TEXT|st:LINK"/>]
  173.   </a>
  174.  </xsl:template>
  175.  
  176.  <xsl:template match="st:TEXT" >
  177.   <xsl:value-of select="."/>
  178.  </xsl:template>
  179.  
  180.  <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
  181.   <xsl:copy>
  182.    <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
  183.   </xsl:copy>
  184.  </xsl:template>
  185.  
  186. </xsl:stylesheet>
  187.