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 / xdoc2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  2.7 KB  |  94 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.  
  21.  <xsl:output indent="yes" 
  22.              method="xml"/>
  23.  
  24.  <xsl:template match="//document">
  25. <!--  <div style="background: #b9d3ee; border: thin; border-color: black; border-style: solid; padding-left: 0.8em; 
  26.               padding-right: 0.8em; padding-top: 0px; padding-bottom: 0px; margin: 0.5ex 0px; clear: both;">-->
  27.    <p>
  28.    <xsl:apply-templates select="body/p|body/section"/>
  29.    </p>
  30. <!--  </div>-->
  31.  </xsl:template>
  32.  
  33.  <xsl:template match="section">
  34.   <xsl:choose> <!-- stupid test for the hirachy deep -->
  35.    <xsl:when test="../../../section">
  36.     <h5><xsl:value-of select="title"/></h5>
  37.    </xsl:when>
  38.    <xsl:when test="../../section">
  39.     <h4><xsl:value-of select="title"/></h4>
  40.    </xsl:when>
  41.    <xsl:when test="../section">
  42.     <h3><xsl:value-of select="title"/></h3>
  43.    </xsl:when>
  44.   </xsl:choose>
  45.   <p>
  46.    <xsl:apply-templates select="*[name()!='title']"/>
  47.   </p>
  48.  </xsl:template>
  49.  
  50.  <xsl:template match="source">
  51.   <div style="background: #b9d3ee; border: thin; border-color: black; border-style: solid; padding-left: 0.8em; 
  52.               padding-right: 0.8em; padding-top: 0px; padding-bottom: 0px; margin: 0.5ex 0px; clear: both;">
  53.   <pre>
  54.    <xsl:value-of select="."/>
  55.   </pre>
  56.   </div>
  57.  </xsl:template>
  58.  
  59.  <xsl:template match="link">
  60.   <xsl:text> </xsl:text>
  61.   <a href="{@href}">
  62.    <xsl:apply-templates/>
  63.   </a>
  64.   <xsl:text> </xsl:text>
  65.  </xsl:template>
  66.  
  67.  <xsl:template match="strong">
  68.   <xsl:text> </xsl:text>
  69.   <b>
  70.    <xsl:apply-templates/>
  71.   </b>
  72.   <xsl:text> </xsl:text>
  73.  </xsl:template>
  74.  
  75.  <xsl:template match="anchor">
  76.   <a name="{@name}">
  77.    <xsl:apply-templates/>
  78.   </a>
  79.  </xsl:template>
  80.  
  81.  <xsl:template match="table">
  82.   <table border="1" cellspacing="3" cellpadding="3">
  83.    <xsl:apply-templates/>
  84.   </table>
  85.  </xsl:template>
  86.  
  87.  <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
  88.   <xsl:copy>
  89.    <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
  90.   </xsl:copy>
  91.  </xsl:template>
  92.  
  93. </xsl:stylesheet>
  94.