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 / error2html-debug.xslt < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  4.0 KB  |  126 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. <!-- CVS $Id: error2html-debug.xslt,v 1.2 2004/03/06 02:26:08 antonio Exp $ -->
  19.  
  20. <xsl:stylesheet version="1.0"
  21.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22.  xmlns:error="http://apache.org/cocoon/error/2.1">
  23.  
  24. <xsl:param name="home" select="string('')"/>
  25.  
  26. <xsl:template match="error:notify">
  27.  <html>
  28.   <head>
  29.    <title>
  30.     <xsl:value-of select="error:title"/>
  31.    </title>
  32.    <link href="{$home}/styles/main.css" type="text/css" rel="stylesheet"/>
  33.    <style>
  34.         body { padding: 20px }
  35.         p.message { padding: 10px 30px 10px 30px; font-weight: bold; font-size: 130%; border-width: 1px; border-style: dashed; border-color: #336699; }
  36.         p.description { padding: 10px 30px 20px 30px; border-width: 0px 0px 1px 0px; border-style: solid; border-color: #336699;}
  37.         p.topped { padding-top: 10px; border-width: 1px 0px 0px 0px; border-style: solid; border-color: #336699; }
  38.         span.description { color: #336699; font-weight: bold; }
  39.         span.switch { cursor: pointer; margin-left: 5px; text-decoration: underline; }
  40.    </style>
  41.  <script><![CDATA[
  42. function toggle(id) {
  43.     var element = document.getElementById(id);
  44.     with (element.style) {
  45.         if ( display == "none" ){
  46.             display = ""
  47.         } else{
  48.             display = "none"
  49.         }
  50.     }
  51.     var text = document.getElementById(id + "-switch").firstChild;
  52.     if (text.nodeValue == "[show]") {
  53.         text.nodeValue = "[hide]";
  54.     } else {
  55.         text.nodeValue = "[show]";
  56.     }
  57. }
  58. ]]></script>
  59.   </head>
  60.   <body>
  61.    <h1><xsl:value-of select="error:title"/></h1>
  62.  
  63.    <p class="message">
  64.     <xsl:call-template name="returns2br">
  65.      <xsl:with-param name="string" select="error:message"/>
  66.     </xsl:call-template>
  67.    </p>
  68.  
  69.    <p class="description">
  70.     <xsl:call-template name="returns2br">
  71.      <xsl:with-param name="string" select="error:description"/>
  72.     </xsl:call-template>
  73.    </p>
  74.  
  75.    <xsl:apply-templates select="error:extra"/>
  76.  
  77.    <p class="topped">
  78.     The <a href="http://cocoon.apache.org/">Apache Cocoon</a> Project
  79.    </p>
  80.   </body>
  81.  </html>
  82. </xsl:template>
  83.  
  84. <xsl:template match="error:extra">
  85.  <xsl:choose>
  86.   <xsl:when test="contains(@error:description,'stacktrace')">
  87.    <p class="stacktrace">
  88.     <span class="description"><xsl:value-of select="@error:description"/></span>
  89.     <span class="switch" id="{@error:description}-switch" onclick="toggle('{@error:description}')">[show]</span>
  90.     <pre id="{@error:description}" style="display: none">
  91.      <xsl:call-template name="returns2br">
  92.       <xsl:with-param name="string" select="."/>
  93.      </xsl:call-template>
  94.     </pre>
  95.    </p>
  96.   </xsl:when>
  97.   <xsl:otherwise>
  98.    <p class="extra">
  99.     <span class="description"><xsl:value-of select="@error:description"/>: </span>
  100.     <xsl:call-template name="returns2br">
  101.      <xsl:with-param name="string" select="."/>
  102.     </xsl:call-template>
  103.    </p>
  104.   </xsl:otherwise>
  105.  </xsl:choose>
  106. </xsl:template>
  107.  
  108. <xsl:template name="returns2br">
  109.   <xsl:param name="string"/>
  110.   <xsl:variable name="return" select="' '"/>
  111.   <xsl:choose>
  112.     <xsl:when test="contains($string,$return)">
  113.       <xsl:value-of select="substring-before($string,$return)"/>
  114.       <br/>
  115.       <xsl:call-template name="returns2br">
  116.         <xsl:with-param name="string" select="substring-after($string,$return)"/>
  117.       </xsl:call-template>
  118.     </xsl:when>
  119.     <xsl:otherwise>
  120.       <xsl:value-of select="$string"/>
  121.     </xsl:otherwise>
  122.   </xsl:choose>
  123. </xsl:template>
  124.  
  125. </xsl:stylesheet>
  126.