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 / profile2page.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  7.5 KB  |  306 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:profile="http://apache.org/cocoon/profiler/1.0">
  20.  
  21.  <xsl:import href="xml2html.xsl"/>
  22.  
  23.  <xsl:output indent="yes"/>
  24.  
  25.  <xsl:param name="key"/>
  26.  <xsl:param name="result"/>
  27.  <xsl:param name="component"/>
  28.  
  29.  <xsl:template match="/">
  30.   <document>
  31.    <header>
  32.     <tab title="Back" href="profile.html"/>
  33.     <tab title="Overview" href="welcome"/>
  34.     <style href="xml2html.css"/>
  35.     <script href="xml2html.js"/>
  36.    </header>
  37.    <body>
  38.     <xsl:choose>
  39.      <xsl:when test="$component!=''">
  40.       <xsl:apply-templates
  41.           select="profile:profilerinfo/profile:pipeline/profile:result/profile:component[@index=$component]"
  42.           mode="fragment"/>
  43.      </xsl:when>
  44.      <xsl:when test="$result!=''">
  45.       <xsl:apply-templates select="profile:profilerinfo/profile:pipeline/profile:result" mode="result"/>
  46.      </xsl:when>
  47.      <xsl:when test="$key!=''">
  48.       <xsl:apply-templates select="profile:profilerinfo/profile:pipeline" mode="results"/>
  49.      </xsl:when>
  50.      <xsl:otherwise>
  51.       <xsl:apply-templates select="profile:profilerinfo" mode="pipelines"/>
  52.      </xsl:otherwise>
  53.     </xsl:choose>
  54.  
  55.    </body>
  56.   </document>
  57.  </xsl:template>
  58.  
  59.  <xsl:template match="profile:profilerinfo" mode="pipelines">
  60.  
  61.   <row>
  62.    <column title="Overview">
  63.  
  64.     <table width="100%" cellspacing="0" cellpadding="5" align="left">
  65.      <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  66.  
  67.       <tr>
  68.        <td align="left"><b>URI</b></td>
  69.        <td align="left"><b>Average(Total time)</b></td>
  70.        <td align="left" colspan="10"><b>Last Results(Total time)</b></td>
  71.       </tr>
  72.  
  73.       <xsl:for-each select="profile:pipeline">
  74.  
  75.        <tr bgcolor="#FFFFFF">
  76.         <td>
  77.          <a href="?key={@key}">
  78.           <font face="verdana"><strong><xsl:value-of select="@uri"/></strong></font>
  79.          </a>
  80.         </td>
  81.         <td>
  82.          <a href="?key={@key}">
  83.           <xsl:value-of select="profile:average/@time"/> ms
  84.          </a>
  85.         </td>
  86.         <xsl:for-each select="profile:result">
  87.          <td>
  88.           <a href="?key={../@key}&result={@index}">
  89.            <xsl:value-of select="@time"/> ms
  90.           </a>
  91.          </td>
  92.         </xsl:for-each>
  93.        </tr>
  94.  
  95.       </xsl:for-each>
  96.  
  97.      </font>
  98.     </table>
  99.  
  100.    </column>
  101.   </row>
  102.  
  103.  </xsl:template>
  104.  
  105.  <xsl:template match="profile:pipeline" mode="results">
  106.  
  107.   <row>
  108.    <column title="{@uri}">
  109.  
  110.     <table width="100%" cellspacing="0" cellpadding="5" align="left">
  111.      <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  112.  
  113.       <tr>
  114.        <td align="left"><b>NN</b></td>
  115.        <td align="left"><b>Components(Role)</b></td>
  116.        <td align="left"><b>Average time</b></td>
  117.        <td align="left"><b>Last time</b></td>
  118.       </tr>
  119.  
  120.       <xsl:for-each select="profile:average/profile:component">
  121.        <tr>
  122.  
  123.         <xsl:variable name="pos" select="position()"/>
  124.         <td width="1%">
  125.          <xsl:value-of select="$pos"/>
  126.         </td>
  127.         <td width="10%">
  128.          <xsl:value-of select="@role"/>
  129.          <xsl:if test="@source">
  130.           (<xsl:value-of select="@source"/>)
  131.          </xsl:if>
  132.         </td>
  133.  
  134.         <xsl:for-each select="../../profile:average/profile:component[position()=$pos]">
  135.          <td>
  136.           <xsl:value-of select="@time"/> ms
  137.          </td>
  138.         </xsl:for-each>
  139.  
  140.         <xsl:for-each select="../../profile:result/profile:component[position()=$pos]">
  141.          <td>
  142.           <a href="?key={../../@key}&result={../@index}&component={@index}">
  143.            <xsl:value-of select="@time"/> ms
  144.           </a>
  145.          </td>
  146.         </xsl:for-each>
  147.  
  148.        </tr>
  149.       </xsl:for-each>
  150.  
  151.       <tr>
  152.        <td></td>
  153.        <td><b>Total time</b></td>
  154.        <td><b><xsl:value-of select="profile:result/@time"/> ms</b></td>
  155.        <xsl:for-each select="profile:result">
  156.         <td>
  157.          <b>
  158.           <xsl:value-of select="@time"/> ms
  159.          </b>
  160.         </td>
  161.        </xsl:for-each>
  162.       </tr>
  163.  
  164.      </font>
  165.     </table>
  166.  
  167.    </column>
  168.   </row>
  169.  
  170.  </xsl:template>
  171.  
  172.  <xsl:template match="profile:result" mode="result">
  173.  
  174.   <row>
  175.    <column title="{../@uri}">
  176.  
  177.     <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2"  width="100%" align="center">
  178.  
  179.      <tr>
  180.       <td align="left"><b>Components</b></td>
  181.       <td align="left"><b>Total time</b></td>
  182.       <td align="left"><b>Setup time</b></td>
  183.       <td align="left"><b>Processing time</b></td>
  184.      </tr>
  185.  
  186.  
  187.      <xsl:for-each select="profile:component">
  188.       <tr>
  189.        <td>
  190.         <a href="?key={../../@key}&result={../@index}&component={@index}">
  191.          <xsl:value-of select="@role"/>
  192.          <xsl:if test="@source">
  193.           (<xsl:value-of select="@source"/>)
  194.          </xsl:if>
  195.         </a>
  196.        </td>
  197.        <td>
  198.         <xsl:value-of select="@time"/> ms
  199.        </td>
  200.        <td>
  201.         <xsl:value-of select="@setup"/> ms
  202.        </td>
  203.        <td>
  204.         <xsl:value-of select="@processing"/> ms
  205.        </td>
  206.       </tr>
  207.      </xsl:for-each>
  208.  
  209.     </table>
  210.  
  211.    </column>
  212.  
  213.   </row>
  214.  
  215.   <row>
  216.  
  217.    <column title="Request parameters">
  218.  
  219.     <table width="100%" cellspacing="0" cellpadding="5" align="center">
  220.      <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  221.  
  222.       <tr>
  223.        <td align="left"><b>Name</b></td>
  224.        <td align="left"><b>Value</b></td>
  225.       </tr>
  226.  
  227.       <xsl:for-each select="profile:environmentinfo/profile:request-parameters/profile:parameter">
  228.        <tr>
  229.         <td><xsl:value-of select="@name"/></td>
  230.         <td><xsl:value-of select="@value"/></td>
  231.        </tr>
  232.       </xsl:for-each>
  233.  
  234.       <tr>
  235.        <td> </td>
  236.        <td> </td>
  237.       </tr>
  238.  
  239.      </font>
  240.     </table>
  241.     
  242.    </column>
  243.  
  244.   </row>
  245.  
  246.   <row>
  247.  
  248.    <column title="Session attributes">
  249.  
  250.     <table width="100%" cellspacing="0" cellpadding="5" align="center">
  251.      <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  252.  
  253.       <tr>
  254.        <td align="left"><b>Name</b></td>
  255.        <td align="left"><b>Value</b></td>
  256.       </tr>
  257.   
  258.       <xsl:for-each select="profile:environmentinfo/profile:session-attributes/profile:attribute">
  259.        <tr>
  260.         <td><xsl:value-of select="@name"/></td>
  261.         <td><xsl:value-of select="@value"/></td>
  262.        </tr>
  263.       </xsl:for-each>
  264.  
  265.       <tr>
  266.        <td> </td>
  267.        <td> </td>
  268.       </tr>
  269.  
  270.      </font>
  271.     </table>
  272.  
  273.    </column>
  274.   </row>
  275.  
  276.  </xsl:template>
  277.  
  278.  <xsl:template match="profile:component" mode="fragment">
  279.  
  280.   <row>
  281.    <column>
  282.     <xsl:attribute name="title">
  283.      <xsl:value-of select="@role"/>
  284.      <xsl:if test="@source">
  285.       (<xsl:value-of select="@source"/>)
  286.      </xsl:if>
  287.     </xsl:attribute>
  288.  
  289.     <xsl:choose>
  290.      <xsl:when test="profile:fragment">
  291.       <xsl:for-each select="profile:fragment">
  292.        <xsl:apply-templates mode="xml2html"/>
  293.       </xsl:for-each>
  294.      </xsl:when>
  295.      <xsl:otherwise>
  296.       <b>Fragment not available!</b>
  297.      </xsl:otherwise>
  298.     </xsl:choose>
  299.  
  300.    </column>
  301.   </row>
  302.  
  303.  </xsl:template>
  304.  
  305. </xsl:stylesheet>
  306.