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 / xml2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  9.2 KB  |  297 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.  |
  19.  | XSLT REC Compliant Version of IE5 Default Stylesheet
  20.  |
  21.  | Original version by Jonathan Marsh (jmarsh@microsoft.com)
  22.  | http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl
  23.  |
  24.  | Conversion to XSLT 1.0 REC Syntax by Steve Muench (smuench@oracle.com)
  25.  | Added script support by Andrew Timberlake (andrew@timberlake.co.za)
  26.  |
  27.  +-->
  28. <xsl:stylesheet version="1.0" 
  29.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  30.  
  31.    <xsl:template match="processing-instruction()" mode="xml2html">
  32.       <DIV class="e">
  33.          <SPAN class="b">
  34.                  <xsl:call-template name="nbsp-ref"/>
  35.          </SPAN>
  36.          <SPAN class="m">
  37.             <xsl:text><?</xsl:text>
  38.          </SPAN>
  39.          <SPAN class="pi">
  40.             <xsl:value-of select="name(.)"/>
  41.             <xsl:value-of select="."/>
  42.          </SPAN>
  43.          <SPAN class="m">
  44.             <xsl:text>?></xsl:text>
  45.          </SPAN>
  46.       </DIV>
  47.    </xsl:template>
  48.  
  49.    <xsl:template match="processing-instruction('xml')" mode="xml2html">
  50.       <DIV class="e">
  51.          <SPAN class="b">
  52.             <xsl:call-template name="nbsp-ref"/>
  53.          </SPAN>
  54.          <SPAN class="m">
  55.             <xsl:text><?</xsl:text>
  56.          </SPAN>
  57.          <SPAN class="pi">
  58.             <xsl:text>xml </xsl:text>
  59.             <xsl:for-each select="@*">
  60.                <xsl:value-of select="name(.)"/>
  61.                <xsl:text>="</xsl:text>
  62.                <xsl:value-of select="."/>
  63.                <xsl:text>" </xsl:text>
  64.             </xsl:for-each>
  65.          </SPAN>
  66.          <SPAN class="m">
  67.             <xsl:text>?></xsl:text>
  68.          </SPAN>
  69.       </DIV>
  70.    </xsl:template>
  71.  
  72.    <xsl:template match="@*" mode="xml2html">
  73.       <SPAN>
  74.          <xsl:attribute name="class">
  75.             <xsl:if test="xsl:*/@*">
  76.               <xsl:text>x</xsl:text>
  77.             </xsl:if>
  78.             <xsl:text>t</xsl:text>
  79.          </xsl:attribute>
  80.          <xsl:value-of select="name(.)"/>
  81.       </SPAN>
  82.       <SPAN class="m">="</SPAN>
  83.       <B>
  84.          <xsl:value-of select="."/>
  85.       </B>
  86.       <SPAN class="m">"</SPAN>
  87.       <xsl:if test="position()!=last()">
  88.          <xsl:text> </xsl:text>
  89.       </xsl:if>
  90.    </xsl:template>
  91.  
  92.    <xsl:template match="text()" mode="xml2html">
  93.       <DIV class="e">
  94.          <SPAN class="b"> </SPAN>
  95.          <SPAN class="tx">
  96.             <xsl:value-of select="."/>
  97.          </SPAN>
  98.       </DIV>
  99.    </xsl:template>
  100.  
  101.    <xsl:template match="comment()" mode="xml2html">
  102.       <DIV class="k">
  103.          <SPAN>
  104.             <A STYLE="visibility:hidden" class="b" onclick="return false" onfocus="h()">-</A>
  105.             <SPAN class="m">
  106.                <xsl:text><!--</xsl:text>
  107.             </SPAN>
  108.          </SPAN>
  109.          <SPAN class="ci" id="clean">
  110.             <PRE>
  111.                <xsl:value-of select="."/>
  112.             </PRE>
  113.          </SPAN>
  114.          <SPAN class="b">
  115.             <xsl:call-template name="nbsp-ref"/>
  116.          </SPAN>
  117.          <SPAN class="m">
  118.             <xsl:text>--></xsl:text>
  119.          </SPAN>
  120.          <SCRIPT>if(document.all)f(clean);</SCRIPT>
  121.       </DIV>
  122.    </xsl:template>
  123.  
  124.    <xsl:template match="*" mode="xml2html">
  125.       <DIV class="e">
  126.          <DIV STYLE="margin-left:1em;text-indent:-2em">
  127.             <SPAN class="b">
  128.                     <xsl:call-template name="nbsp-ref"/>
  129.             </SPAN>
  130.             <SPAN class="m"><</SPAN>
  131.             <SPAN>
  132.                <xsl:attribute name="class">
  133.                   <xsl:if test="xsl:*">
  134.                      <xsl:text>x</xsl:text>
  135.                   </xsl:if>
  136.                   <xsl:text>t</xsl:text>
  137.                </xsl:attribute>
  138.                <xsl:value-of select="name(.)"/>
  139.                <xsl:if test="@*">
  140.                   <xsl:text> </xsl:text>
  141.                </xsl:if>
  142.             </SPAN>
  143.             <xsl:apply-templates select="@*" mode="xml2html"/>
  144.             <SPAN class="m">
  145.                <xsl:text>/></xsl:text>
  146.             </SPAN>
  147.          </DIV>
  148.       </DIV>
  149.    </xsl:template>
  150.  
  151.    <xsl:template match="*[node()]" mode="xml2html">
  152.       <DIV class="e">
  153.          <DIV class="c">
  154.             <A class="b" href="#" onclick="return false" onfocus="h()">-</A>
  155.             <SPAN class="m"><</SPAN>
  156.             <SPAN>
  157.                <xsl:attribute name="class">
  158.                   <xsl:if test="xsl:*">
  159.                      <xsl:text>x</xsl:text>
  160.                   </xsl:if>
  161.                   <xsl:text>t</xsl:text>
  162.                </xsl:attribute>
  163.                <xsl:value-of select="name(.)"/>
  164.                <xsl:if test="@*">
  165.                   <xsl:text> </xsl:text>
  166.                </xsl:if>
  167.             </SPAN>
  168.             <xsl:apply-templates select="@*" mode="xml2html"/>
  169.             <SPAN class="m">
  170.                <xsl:text>></xsl:text>
  171.             </SPAN>
  172.          </DIV>
  173.          <DIV>
  174.             <xsl:apply-templates mode="xml2html"/>
  175.             <DIV>
  176.                <SPAN class="b">
  177.                         <xsl:call-template name="nbsp-ref"/>
  178.                </SPAN>
  179.                <SPAN class="m">
  180.                   <xsl:text></</xsl:text>
  181.                </SPAN>
  182.                <SPAN>
  183.                   <xsl:attribute name="class">
  184.                      <xsl:if test="xsl:*">
  185.                         <xsl:text>x</xsl:text>
  186.                      </xsl:if>
  187.                      <xsl:text>t</xsl:text>
  188.                   </xsl:attribute>
  189.                   <xsl:value-of select="name(.)"/>
  190.                </SPAN>
  191.                <SPAN class="m">
  192.                   <xsl:text>></xsl:text>
  193.                </SPAN>
  194.             </DIV>
  195.          </DIV>
  196.       </DIV>
  197.    </xsl:template>
  198.  
  199.    <xsl:template match="*[text() and not (comment() or processing-instruction())]" mode="xml2html">
  200.       <DIV class="e">
  201.          <DIV STYLE="margin-left:1em;text-indent:-2em">
  202.             <SPAN class="b">
  203.                     <xsl:call-template name="nbsp-ref"/>
  204.             </SPAN>
  205.             <SPAN class="m">
  206.                <xsl:text><</xsl:text>
  207.             </SPAN>
  208.             <SPAN>
  209.                <xsl:attribute name="class">
  210.                   <xsl:if test="xsl:*">
  211.                      <xsl:text>x</xsl:text>
  212.                   </xsl:if>
  213.                   <xsl:text>t</xsl:text>
  214.                </xsl:attribute>
  215.                <xsl:value-of select="name(.)"/>
  216.                <xsl:if test="@*">
  217.                   <xsl:text> </xsl:text>
  218.                </xsl:if>
  219.             </SPAN>
  220.             <xsl:apply-templates select="@*" mode="xml2html"/>
  221.             <SPAN class="m">
  222.                <xsl:text>></xsl:text>
  223.             </SPAN>
  224.             <SPAN class="tx">
  225.                <xsl:value-of select="."/>
  226.             </SPAN>
  227.             <SPAN class="m"></</SPAN>
  228.             <SPAN>
  229.                <xsl:attribute name="class">
  230.                   <xsl:if test="xsl:*">
  231.                      <xsl:text>x</xsl:text>
  232.                   </xsl:if>
  233.                   <xsl:text>t</xsl:text>
  234.                </xsl:attribute>
  235.                <xsl:value-of select="name(.)"/>
  236.             </SPAN>
  237.             <SPAN class="m">
  238.                <xsl:text>></xsl:text>
  239.             </SPAN>
  240.          </DIV>
  241.       </DIV>
  242.    </xsl:template>
  243.  
  244.    <xsl:template match="*[*]" priority="20" mode="xml2html">
  245.       <DIV class="e">
  246.          <DIV STYLE="margin-left:1em;text-indent:-2em" class="c">
  247.             <A class="b" href="#" onclick="return false" onfocus="h()">-</A>
  248.             <SPAN class="m"><</SPAN>
  249.             <SPAN>
  250.                <xsl:attribute name="class">
  251.                   <xsl:if test="xsl:*">
  252.                      <xsl:text>x</xsl:text>
  253.                   </xsl:if>
  254.                   <xsl:text>t</xsl:text>
  255.                </xsl:attribute>
  256.                <xsl:value-of select="name(.)"/>
  257.                <xsl:if test="@*">
  258.                   <xsl:text> </xsl:text>
  259.                </xsl:if>
  260.             </SPAN>
  261.             <xsl:apply-templates select="@*" mode="xml2html"/>
  262.             <SPAN class="m">
  263.                <xsl:text>></xsl:text>
  264.             </SPAN>
  265.          </DIV>
  266.          <DIV>
  267.             <xsl:apply-templates mode="xml2html"/>
  268.             <DIV>
  269.                <SPAN class="b">
  270.                         <xsl:call-template name="nbsp-ref"/>
  271.                </SPAN>
  272.                <SPAN class="m">
  273.                   <xsl:text></</xsl:text>
  274.                </SPAN>
  275.                <SPAN>
  276.                   <xsl:attribute name="class">
  277.                      <xsl:if test="xsl:*">
  278.                         <xsl:text>x</xsl:text>
  279.                      </xsl:if>
  280.                      <xsl:text>t</xsl:text>
  281.                   </xsl:attribute>
  282.                   <xsl:value-of select="name(.)"/>
  283.                </SPAN>
  284.                <SPAN class="m">
  285.                   <xsl:text>></xsl:text>
  286.                </SPAN>
  287.             </DIV>
  288.          </DIV>
  289.       </DIV>
  290.    </xsl:template>
  291.  
  292.    <xsl:template name="nbsp-ref">
  293.       <xsl:text> </xsl:text>
  294.    </xsl:template>
  295.  
  296. </xsl:stylesheet>
  297.