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 / error2page.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.3 KB  |  87 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: error2page.xsl,v 1.2 2004/03/06 02:25:33 antonio Exp $ -->
  19.  
  20. <xsl:stylesheet version="1.0"
  21.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22.                 xmlns:lex="http://chaperon.sourceforge.net/schema/lexer/2.0"
  23.                 xmlns:st="http://chaperon.sourceforge.net/schema/syntaxtree/2.0">
  24.  
  25.  <xsl:param name="contextPath"/>
  26.  
  27.  <!-- let sitemap override default page title -->
  28.  <xsl:param name="pageTitle" select="//parse-exception/message"/>
  29.  
  30.  <xsl:template match="header">
  31.   <xsl:copy>
  32.    <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
  33.    <style href="error.css"/>
  34.   </xsl:copy>
  35.  </xsl:template>
  36.  
  37.  <xsl:template match="st:output[st:error]">
  38.   <row>
  39.    <column title="{st:error/@message}">
  40.  
  41.     <p class="extra"><span class="description">column </span><xsl:value-of select="st:error/@column"/></p>
  42.     <p class="extra"><span class="description">line </span><xsl:value-of select="st:error/@line"/></p>
  43.     <xsl:if test="source">
  44.      <p class="extra"><span class="description">source </span><xsl:value-of select="@source"/></p>
  45.     </xsl:if>
  46.  
  47.     <xsl:apply-templates select="st:error"/>
  48.  
  49.    </column>
  50.   </row>
  51.  </xsl:template>
  52.  
  53.  <xsl:template match="st:error">
  54.   <xsl:variable name="line" select="number(@line)"/>
  55.  
  56.   <p class="topped">
  57.    <pre class="error">
  58.     <xsl:apply-templates select="lex:output/lex:lexeme[(number(@line) < $line) and (number(@line) > number($line - 10))]" mode="lt"/>
  59.     <xsl:apply-templates select="lex:output/lex:lexeme[number(@line) = $line]" mode="eq"/>
  60.     <xsl:apply-templates select="lex:output/lex:lexeme[(number(@line) > $line) and (number(@line) < number($line + 10))]" mode="gt"/>
  61.    </pre>
  62.   </p>
  63.  </xsl:template>
  64.  
  65.  <xsl:template match="lex:lexeme" mode="lt">
  66.   <xsl:value-of select="@line"/> : <span class="lt"><xsl:value-of select="@text"/></span>
  67.  </xsl:template>
  68.  
  69.  <xsl:template match="lex:lexeme" mode="eq">
  70.   <xsl:variable name="column" select="number(../../@column)"/>
  71.   <xsl:value-of select="@line"/> : <span class="lt"><xsl:value-of select="substring(@text, 1, $column - 1)"/></span>
  72.   <span class="eq"><xsl:value-of select="substring(@text, $column, 1)"/></span>
  73.   <span class="gt"><xsl:value-of select="substring(@text, $column + 1, string-length(@text) - $column)"/></span>
  74.  </xsl:template>
  75.  
  76.  <xsl:template match="lex:lexeme" mode="gt">
  77.   <xsl:value-of select="@line"/> : <span class="gt"><xsl:value-of select="@text"/></span>
  78.  </xsl:template>
  79.  
  80.  <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
  81.   <xsl:copy>
  82.    <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
  83.   </xsl:copy>
  84.  </xsl:template>
  85.  
  86. </xsl:stylesheet>
  87.