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 / java2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  13.4 KB  |  456 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:lex="http://chaperon.sourceforge.net/schema/lexer/2.0">
  20.  
  21.  <xsl:output indent="no"/>
  22.  
  23.  <xsl:param name="package"/>
  24.  <xsl:param name="class"/>
  25.  
  26.  <xsl:param name="prefix">cocoon/samples/chaperon/</xsl:param>
  27.  
  28.  <xsl:template match="/lex:output">
  29.   <document>
  30.    <header>
  31.     <title>Java2HTML example</title>
  32.     <style href="java.css"/>
  33.    </header>
  34.    <body>
  35.     <row>
  36.      <column title="Source file: {$class}">
  37.       <pre class="srcLine"><xsl:apply-templates select="lex:lexeme"/></pre>
  38.      </column>
  39.     </row>
  40.    </body>
  41.   </document>
  42.  </xsl:template>
  43.  
  44.  <xsl:template match="package">
  45.   <a href="/{$prefix}{translate(@full,'.','/')}/index.html"><xsl:value-of select="@full"/></a><br/>
  46.  </xsl:template>
  47.  
  48.  <xsl:template match="class">
  49.   <a href="/{$prefix}{translate(@full,'.','/')}.java.html"><xsl:value-of select="@name"/></a><br/>
  50.  </xsl:template>
  51.  
  52.  <xsl:template name="linenumber">
  53.   <xsl:param name="nr">1</xsl:param>
  54.   <xsl:param name="max">1</xsl:param> <xsl:value-of select="$nr"/><xsl:text>
  55. </xsl:text><xsl:if test="$nr <= $max">
  56.    <xsl:call-template name="linenumber">
  57.      <xsl:with-param name="nr"  select="$nr + 1"/>
  58.      <xsl:with-param name="max" select="$max"/>
  59.    </xsl:call-template>
  60.   </xsl:if>
  61.  </xsl:template>
  62.  
  63.  <xsl:template match="lex:lexeme[@symbol='ABSTRACT']">
  64.   <font class="ABSTRACT"><xsl:value-of select="@text"/></font>
  65.  </xsl:template>
  66.  
  67.  <xsl:template match="lex:lexeme[@symbol='BOOLEAN']">
  68.   <font class="BOOLEAN"><xsl:value-of select="@text"/></font>
  69.  </xsl:template>
  70.  
  71.  <xsl:template match="lex:lexeme[@symbol='BREAK']">
  72.   <font class="BREAK"><xsl:value-of select="@text"/></font>
  73.  </xsl:template>
  74.  
  75.  <xsl:template match="lex:lexeme[@symbol='BYTE']">
  76.   <font class="BYTE"><xsl:value-of select="@text"/></font>
  77.  </xsl:template>
  78.  
  79.  <xsl:template match="lex:lexeme[@symbol='CASE']">
  80.   <font class="CASE"><xsl:value-of select="@text"/></font>
  81.  </xsl:template>
  82.  
  83.  <xsl:template match="lex:lexeme[@symbol='CATCH']">
  84.   <font class="CATCH"><xsl:value-of select="@text"/></font>
  85.  </xsl:template>
  86.  
  87.  <xsl:template match="lex:lexeme[@symbol='CHAR']">
  88.   <font class="CHAR"><xsl:value-of select="@text"/></font>
  89.  </xsl:template>
  90.  
  91.  <xsl:template match="lex:lexeme[@symbol='CLASS']">
  92.   <font class="CLASS"><xsl:value-of select="@text"/></font>
  93.  </xsl:template>
  94.  
  95.  <xsl:template match="lex:lexeme[@symbol='CONST']">
  96.   <font class="CONST"><xsl:value-of select="@text"/></font>
  97.  </xsl:template>
  98.  
  99.  <xsl:template match="lex:lexeme[@symbol='CONTINUE']">
  100.   <font class="CONTINUE"><xsl:value-of select="@text"/></font>
  101.  </xsl:template>
  102.  
  103.  <xsl:template match="lex:lexeme[@symbol='DEFAULT']">
  104.   <font class="DEFAULT"><xsl:value-of select="@text"/></font>
  105.  </xsl:template>
  106.  
  107.  <xsl:template match="lex:lexeme[@symbol='DO']">
  108.   <font class="DO"><xsl:value-of select="@text"/></font>
  109.  </xsl:template>
  110.  
  111.  <xsl:template match="lex:lexeme[@symbol='DOUBLE']">
  112.   <font class="DOUBLE"><xsl:value-of select="@text"/></font>
  113.  </xsl:template>
  114.  
  115.  <xsl:template match="lex:lexeme[@symbol='ELSE']">
  116.   <font class="ELSE"><xsl:value-of select="@text"/></font>
  117.  </xsl:template>
  118.  
  119.  <xsl:template match="lex:lexeme[@symbol='EXTENDS']">
  120.   <font class="EXTENDS"><xsl:value-of select="@text"/></font>
  121.  </xsl:template>
  122.  
  123.  <xsl:template match="lex:lexeme[@symbol='FALSE']">
  124.   <font class="FALSE"><xsl:value-of select="@text"/></font>
  125.  </xsl:template>
  126.  
  127.  <xsl:template match="lex:lexeme[@symbol='FINAL']">
  128.   <font class="FINAL"><xsl:value-of select="@text"/></font>
  129.  </xsl:template>
  130.  
  131.  <xsl:template match="lex:lexeme[@symbol='FINALLY']">
  132.   <font class="FINALLY"><xsl:value-of select="@text"/></font>
  133.  </xsl:template>
  134.  
  135.  <xsl:template match="lex:lexeme[@symbol='FLOAT']">
  136.   <font class="FLOAT"><xsl:value-of select="@text"/></font>
  137.  </xsl:template>
  138.  
  139.  <xsl:template match="lex:lexeme[@symbol='FOR']">
  140.   <font class="FOR"><xsl:value-of select="@text"/></font>
  141.  </xsl:template>
  142.  
  143.  <xsl:template match="lex:lexeme[@symbol='GOTO']">
  144.   <font class="GOTO"><xsl:value-of select="@text"/></font>
  145.  </xsl:template>
  146.  
  147.  <xsl:template match="lex:lexeme[@symbol='IF']">
  148.   <font class="IF"><xsl:value-of select="@text"/></font>
  149.  </xsl:template>
  150.  
  151.  <xsl:template match="lex:lexeme[@symbol='IMPLEMENTS']">
  152.   <font class="IMPLEMENTS"><xsl:value-of select="@text"/></font>
  153.  </xsl:template>
  154.  
  155.  <xsl:template match="lex:lexeme[@symbol='IMPORT']">
  156.   <font class="IMPORT"><xsl:value-of select="@text"/></font>
  157.  </xsl:template>
  158.  
  159.  <xsl:template match="lex:lexeme[@symbol='INSTANCEOF']">
  160.   <font class="INSTANCEOF"><xsl:value-of select="@text"/></font>
  161.  </xsl:template>
  162.  
  163.  <xsl:template match="lex:lexeme[@symbol='INT']">
  164.   <font class="INT"><xsl:value-of select="@text"/></font>
  165.  </xsl:template>
  166.  
  167.  <xsl:template match="lex:lexeme[@symbol='INTERFACE']">
  168.   <font class="INTERFACE"><xsl:value-of select="@text"/></font>
  169.  </xsl:template>
  170.  
  171.  <xsl:template match="lex:lexeme[@symbol='LONG']">
  172.   <font class="LONG"><xsl:value-of select="@text"/></font>
  173.  </xsl:template>
  174.  
  175.  <xsl:template match="lex:lexeme[@symbol='NATIVE']">
  176.   <font class="NATIVE"><xsl:value-of select="@text"/></font>
  177.  </xsl:template>
  178.  
  179.  <xsl:template match="lex:lexeme[@symbol='NEW']">
  180.   <font class="NEW"><xsl:value-of select="@text"/></font>
  181.  </xsl:template>
  182.  
  183.  <xsl:template match="lex:lexeme[@symbol='PACKAGE']">
  184.   <font class="PACKAGE"><xsl:value-of select="@text"/></font>
  185.  </xsl:template>
  186.  
  187.  <xsl:template match="lex:lexeme[@symbol='PRIVATE']">
  188.   <font class="PRIVATE"><xsl:value-of select="@text"/></font>
  189.  </xsl:template>
  190.  
  191.  <xsl:template match="lex:lexeme[@symbol='PROTECTED']">
  192.   <font class="PROTECTED"><xsl:value-of select="@text"/></font>
  193.  </xsl:template>
  194.  
  195.  <xsl:template match="lex:lexeme[@symbol='PUBLIC']">
  196.   <font class="PUBLIC"><xsl:value-of select="@text"/></font>
  197.  </xsl:template>
  198.  
  199.  <xsl:template match="lex:lexeme[@symbol='RETURN']">
  200.   <font class="RETURN"><xsl:value-of select="@text"/></font>
  201.  </xsl:template>
  202.  
  203.  <xsl:template match="lex:lexeme[@symbol='SHORT']">
  204.   <font class="SHORT"><xsl:value-of select="@text"/></font>
  205.  </xsl:template>
  206.  
  207.  <xsl:template match="lex:lexeme[@symbol='STATIC']">
  208.   <font class="STATIC"><xsl:value-of select="@text"/></font>
  209.  </xsl:template>
  210.  
  211.  <xsl:template match="lex:lexeme[@symbol='SUPER']">
  212.   <font class="SUPER"><xsl:value-of select="@text"/></font>
  213.  </xsl:template>
  214.  
  215.  <xsl:template match="lex:lexeme[@symbol='SWITCH']">
  216.   <font class="SWITCH"><xsl:value-of select="@text"/></font>
  217.  </xsl:template>
  218.  
  219.  <xsl:template match="lex:lexeme[@symbol='SYCHRONIZED']">
  220.   <font class="SYCHRONIZED"><xsl:value-of select="@text"/></font>
  221.  </xsl:template>
  222.  
  223.  <xsl:template match="lex:lexeme[@symbol='THIS']">
  224.   <font class="THIS"><xsl:value-of select="@text"/></font>
  225.  </xsl:template>
  226.  
  227.  <xsl:template match="lex:lexeme[@symbol='THROW']">
  228.   <font class="THROW"><xsl:value-of select="@text"/></font>
  229.  </xsl:template>
  230.  
  231.  <xsl:template match="lex:lexeme[@symbol='THROWS']">
  232.   <font class="THROWS"><xsl:value-of select="@text"/></font>
  233.  </xsl:template>
  234.  
  235.  <xsl:template match="lex:lexeme[@symbol='TRANSIENT']">
  236.   <font class="TRANSIENT"><xsl:value-of select="@text"/></font>
  237.  </xsl:template>
  238.  
  239.  <xsl:template match="lex:lexeme[@symbol='TRUE']">
  240.   <font class="TRUE"><xsl:value-of select="@text"/></font>
  241.  </xsl:template>
  242.  
  243.  <xsl:template match="lex:lexeme[@symbol='TRY']">
  244.   <font class="TRY"><xsl:value-of select="@text"/></font>
  245.  </xsl:template>
  246.  
  247.  <xsl:template match="lex:lexeme[@symbol='VOID']">
  248.   <font class="VOID"><xsl:value-of select="@text"/></font>
  249.  </xsl:template>
  250.  
  251.  <xsl:template match="lex:lexeme[@symbol='VOLATILE']">
  252.   <font class="VOLATILE"><xsl:value-of select="@text"/></font>
  253.  </xsl:template>
  254.  
  255.  <xsl:template match="lex:lexeme[@symbol='WHILE']">
  256.   <font class="WHILE"><xsl:value-of select="@text"/></font>
  257.  </xsl:template>
  258.  
  259.  <xsl:template match="lex:lexeme[@symbol='LITERAL']">
  260.   <font class="LITERAL"><xsl:value-of select="@text"/></font>
  261.  </xsl:template>
  262.  
  263.  <xsl:template match="lex:lexeme[@symbol='IDENTIFIER']">
  264.   <font class="IDENTIFIER"><xsl:value-of select="@text"/></font> 
  265.  </xsl:template>
  266.  
  267.  <xsl:template match="lex:lexeme[@symbol='DOPEN']">
  268.   <xsl:value-of select="@text"/>
  269.  </xsl:template>
  270.  
  271.  <xsl:template match="lex:lexeme[@symbol='DCLOSE']">
  272.   <xsl:value-of select="@text"/>
  273.  </xsl:template>
  274.  
  275.  <xsl:template match="lex:lexeme[@symbol='COPEN']">
  276.   <xsl:value-of select="@text"/>
  277.  </xsl:template>
  278.   
  279.  <xsl:template match="lex:lexeme[@symbol='CCLOSE']">
  280.   <xsl:value-of select="@text"/>
  281.  </xsl:template>
  282.  
  283.  <xsl:template match="lex:lexeme[@symbol='BOPEN']">
  284.   <xsl:value-of select="@text"/>
  285.  </xsl:template>
  286.  
  287.  <xsl:template match="lex:lexeme[@symbol='BCLOSE']">
  288.   <xsl:value-of select="@text"/>
  289.  </xsl:template>
  290.  
  291.  <xsl:template match="lex:lexeme[@symbol='SEMICOLON']">
  292.   <xsl:value-of select="@text"/>
  293.  </xsl:template>
  294.  
  295.  <xsl:template match="lex:lexeme[@symbol='COMMA']">
  296.   <xsl:value-of select="@text"/>
  297.  </xsl:template>
  298.  
  299.  <xsl:template match="lex:lexeme[@symbol='DOT']">
  300.   <xsl:value-of select="@text"/>
  301.  </xsl:template>
  302.  
  303.  <xsl:template match="lex:lexeme[@symbol='OP_EQ']">
  304.   <xsl:value-of select="@text"/>
  305.  </xsl:template>
  306.  
  307.  <xsl:template match="lex:lexeme[@symbol='OP_LE']">
  308.   <xsl:value-of select="@text"/>
  309.  </xsl:template>
  310.  
  311.  <xsl:template match="lex:lexeme[@symbol='OP_GE']">
  312.   <xsl:value-of select="@text"/>
  313.  </xsl:template>
  314.  
  315.  <xsl:template match="lex:lexeme[@symbol='OP_NE']">
  316.   <xsl:value-of select="@text"/>
  317.  </xsl:template>
  318.  
  319.  <xsl:template match="lex:lexeme[@symbol='OP_LOR']">
  320.   <xsl:value-of select="@text"/>
  321.  </xsl:template>
  322.  
  323.  <xsl:template match="lex:lexeme[@symbol='OP_LAND']">
  324.   <xsl:value-of select="@text"/>
  325.  </xsl:template>
  326.  
  327.  <xsl:template match="lex:lexeme[@symbol='OP_INC']">
  328.   <xsl:value-of select="@text"/>
  329.  </xsl:template>
  330.  
  331.  <xsl:template match="lex:lexeme[@symbol='OP_DEC']">
  332.   <xsl:value-of select="@text"/>
  333.  </xsl:template>
  334.  
  335.  <xsl:template match="lex:lexeme[@symbol='OP_SHR']">
  336.   <xsl:value-of select="@text"/>
  337.  </xsl:template>
  338.  
  339.  <xsl:template match="lex:lexeme[@symbol='OP_SHL']">
  340.   <xsl:value-of select="@text"/>
  341.  </xsl:template>
  342.  
  343.  <xsl:template match="lex:lexeme[@symbol='OP_SHRR']">
  344.   <xsl:value-of select="@text"/>
  345.  </xsl:template>
  346.  
  347.  <xsl:template match="lex:lexeme[@symbol='ASS_OP']">
  348.   <xsl:value-of select="@text"/>
  349.  </xsl:template>
  350.  
  351.  <xsl:template match="lex:lexeme[@symbol='EQ']">
  352.   <xsl:value-of select="@text"/>
  353.  </xsl:template>
  354.  
  355.  <xsl:template match="lex:lexeme[@symbol='GT']">
  356.   <xsl:value-of select="@text"/>
  357.  </xsl:template>
  358.  
  359.  <xsl:template match="lex:lexeme[@symbol='LT']">
  360.   <xsl:value-of select="@text"/>
  361.  </xsl:template>
  362.  
  363.  <xsl:template match="lex:lexeme[@symbol='NOT']">
  364.   <xsl:value-of select="@text"/>
  365.  </xsl:template>
  366.  
  367.  <xsl:template match="lex:lexeme[@symbol='TILDE']">
  368.   <xsl:value-of select="@text"/>
  369.  </xsl:template>
  370.  
  371.  <xsl:template match="lex:lexeme[@symbol='QM']">
  372.   <xsl:value-of select="@text"/>
  373.  </xsl:template>
  374.  
  375.  <xsl:template match="lex:lexeme[@symbol='COLON']">
  376.   <xsl:value-of select="@text"/>
  377.  </xsl:template>
  378.  
  379.  <xsl:template match="lex:lexeme[@symbol='PLUS']">
  380.   <xsl:value-of select="@text"/>
  381.  </xsl:template>
  382.  
  383.  <xsl:template match="lex:lexeme[@symbol='MINUS']">
  384.   <xsl:value-of select="@text"/>
  385.  </xsl:template>
  386.  
  387.  <xsl:template match="lex:lexeme[@symbol='MULT']">
  388.   <xsl:value-of select="@text"/>
  389.  </xsl:template>
  390.  
  391.  <xsl:template match="lex:lexeme[@symbol='DIV']">
  392.   <xsl:value-of select="@text"/>
  393.  </xsl:template>
  394.  
  395.  <xsl:template match="lex:lexeme[@symbol='AND']">
  396.   <xsl:value-of select="@text"/>
  397.  </xsl:template>
  398.  
  399.  <xsl:template match="lex:lexeme[@symbol='OR']">
  400.   <xsl:value-of select="@text"/>
  401.  </xsl:template>
  402.  
  403.  <xsl:template match="lex:lexeme[@symbol='XOR']">
  404.   <xsl:value-of select="@text"/>
  405.  </xsl:template>
  406.  
  407.  <xsl:template match="lex:lexeme[@symbol='MOD']">
  408.   <xsl:value-of select="@text"/>
  409.  </xsl:template>
  410.  
  411.  <xsl:template match="lex:lexeme[@symbol='BOOLLIT']">
  412.   <xsl:value-of select="@text"/>
  413.  </xsl:template>
  414.  
  415.  <xsl:template match="lex:lexeme[@symbol='EOL']">
  416.   <xsl:text>
  417.  </xsl:text>
  418. <!--  <br/>-->
  419.  </xsl:template>
  420.  
  421.  <xsl:template match="lex:lexeme[@symbol='SPACES']"><xsl:value-of select="@text"/></xsl:template>
  422.  
  423.  <xsl:template match="lex:lexeme[@symbol='TAB']">
  424.   <xsl:text>  </xsl:text>
  425.  </xsl:template>
  426.  
  427.  <xsl:template match="lex:lexeme[@symbol='JAVADOC']">
  428.   <font class="MultiLineComment">/*<xsl:apply-templates select="lex:output/*"/>/</font>
  429.  </xsl:template>
  430.  
  431.  <xsl:template match="lex:lexeme[@symbol='MULTILINECOMMENT']">
  432.   <font class="MultiLineComment"><xsl:value-of select="@text"/></font>
  433.  </xsl:template>
  434.  
  435.  <xsl:template match="lex:lexeme[@symbol='SINGLEMULTILINECOMMENT']">
  436.   <font class="MultiLineComment"><xsl:value-of select="@text"/></font>
  437.  </xsl:template>
  438.  
  439.  <xsl:template match="lex:lexeme[@symbol='ASTERISK']">
  440.   <xsl:value-of select="@text"/>
  441.  </xsl:template>
  442.  
  443.  <xsl:template match="lex:lexeme[@symbol='TEXT']">
  444.   <xsl:value-of select="@text"/>
  445.  </xsl:template>
  446.  
  447.  <xsl:template match="lex:lexeme[@symbol='TAG']">
  448.   <xsl:value-of select="@text"/>
  449.  </xsl:template>
  450.  
  451.  <xsl:template match="lex:lexeme[@symbol='PROPERTYNAME']">
  452.   <xsl:value-of select="@text"/>
  453.  </xsl:template>
  454.  
  455. </xsl:stylesheet>
  456.