You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by je...@apache.org on 2003/03/15 07:26:16 UTC
cvs commit: xml-forrest/src/resources/library/xslt page2html.xsl profile2page.xsl
jefft 2003/03/14 22:26:16
Added: src/resources/library/xslt page2html.xsl profile2page.xsl
Log:
Very preliminary support for profiling
Revision Changes Path
1.1 xml-forrest/src/resources/library/xslt/page2html.xsl
Index: page2html.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>Apache Cocoon 2.1-dev</title>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<xsl:apply-templates select="page/style"/>
<xsl:apply-templates select="page/script"/>
</head>
<body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75">
<table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
<tr>
<td width="*"><font face="arial,helvetica,sanserif" color="#000000">The Apache Software Foundation is proud to
present...</font></td>
<td width="40%" align="center"><img border="0" src="/cocoon/samples/images/cocoon.gif"/></td>
<td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version
2.1-dev</b></font></td>
</tr>
<tr>
<table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
<tr>
<td width="90%" align="left" bgcolor="#0086b2"><font size="+1" face="arial,helvetica,sanserif"
color="#ffffff"><xsl:value-of select="page/@title"/></font></td>
<xsl:apply-templates select="page/tab"/>
</tr>
</table>
</tr>
</table>
<table width="100%">
<xsl:apply-templates select="page/row"/>
</table>
<p align="center">
<font size="-1">
Copyright © 1999-2002 <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/>
All rights reserved.
</font>
</p>
</body>
</html>
</xsl:template>
<xsl:template match="style">
<link type="text/css" rel="stylesheet" href="{@href}"/>
</xsl:template>
<xsl:template match="script">
<script type="text/javascript" src="{@href}"/>
</xsl:template>
<xsl:template match="tab">
<td nowrap="nowrap" bgcolor="#ffffff"><a href="{@href}"><i><xsl:value-of select="@title"/></i></a></td>
</xsl:template>
<xsl:template match="row">
<tr>
<xsl:apply-templates select="column"/>
</tr>
</xsl:template>
<xsl:template match="column">
<td valign="top">
<table border="0" bgcolor="#000000" cellpadding="0" cellspacing="0" width="97%">
<tbody>
<tr>
<td>
<table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
<tr>
<td bgcolor="#0086b2" width="100%" align="left">
<font size="+1" face="arial,helvetica,sanserif" color="#ffffff"><xsl:value-of select="@title"/></font>
</td>
</tr>
<tr>
<td width="100%" bgcolor="#ffffff" align="left">
<xsl:apply-templates/>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</xsl:template>
<xsl:template match="para">
<p align="left">
<i><xsl:apply-templates/></i>
</p>
</xsl:template>
<xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
<xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
</xsl:stylesheet>
1.1 xml-forrest/src/resources/library/xslt/profile2page.xsl
Index: profile2page.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:profile="http://apache.org/cocoon/profiler/1.0">
<xsl:import href="xml2html.xsl"/>
<xsl:output indent="yes"/>
<xsl:param name="key"/>
<xsl:param name="result"/>
<xsl:param name="component"/>
<xsl:template match="/">
<page>
<tab title="Back" href="profile.html"/>
<tab title="Overview" href="welcome"/>
<style href="xml2html.css"/>
<script href="xml2html.js"/>
<xsl:choose>
<xsl:when test="$component!=''">
<xsl:apply-templates
select="profile:profilerinfo/profile:pipeline/profile:result/profile:component[@profile:index=$component]"
mode="fragment"/>
</xsl:when>
<xsl:when test="$result!=''">
<xsl:apply-templates select="profile:profilerinfo/profile:pipeline/profile:result" mode="result"/>
</xsl:when>
<xsl:when test="$key!=''">
<xsl:apply-templates select="profile:profilerinfo/profile:pipeline" mode="results"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="profile:profilerinfo" mode="pipelines"/>
</xsl:otherwise>
</xsl:choose>
</page>
</xsl:template>
<xsl:template match="profile:profilerinfo" mode="pipelines">
<row>
<column title="Overview">
<table width="100%" cellspacing="0" cellpadding="5" align="left">
<font size="+0" face="arial,helvetica,sanserif" color="#000000">
<tr>
<td align="left"><b>URI</b></td>
<td align="left"><b>Average(Total time)</b></td>
<td align="left" colspan="10"><b>Last Results(Total time)</b></td>
</tr>
<xsl:for-each select="profile:pipeline">
<tr bgcolor="#FFFFFF">
<td>
<a href="?key={@profile:key}">
<font face="verdana"><strong><xsl:value-of select="@profile:uri"/></strong></font>
</a>
</td>
<td>
<a href="?key={@profile:key}">
<xsl:value-of select="profile:average/@profile:time"/> ms
</a>
</td>
<xsl:for-each select="profile:result">
<td>
<a href="?key={../@profile:key}&result={@profile:index}">
<xsl:value-of select="@profile:time"/> ms
</a>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</font>
</table>
</column>
</row>
</xsl:template>
<xsl:template match="profile:pipeline" mode="results">
<row>
<column title="{@profile:uri}">
<table width="100%" cellspacing="0" cellpadding="5" align="left">
<font size="+0" face="arial,helvetica,sanserif" color="#000000">
<tr>
<td align="left"><b>NN</b></td>
<td align="left"><b>Components(Role)</b></td>
<td align="left"><b>Average time</b></td>
<td align="left"><b>Lastest times</b></td>
</tr>
<xsl:for-each select="profile:average/profile:component">
<tr>
<xsl:variable name="pos" select="position()"/>
<td width="1%">
<xsl:value-of select="$pos"/>
</td>
<td width="10%">
<xsl:value-of select="@profile:role"/>
<xsl:if test="@profile:source">
(<xsl:value-of select="@profile:source"/>)
</xsl:if>
</td>
<xsl:for-each select="../../profile:average/profile:component[position()=$pos]">
<td>
<xsl:value-of select="@profile:time"/> ms
</td>
</xsl:for-each>
<xsl:for-each select="../../profile:result/profile:component[position()=$pos]">
<td>
<a href="?key={../../@profile:key}&result={../@profile:index}&component={@profile:index}">
<xsl:value-of select="@profile:time"/> ms
</a>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
<tr>
<td></td>
<td><b>Total time</b></td>
<td><b><xsl:value-of select="profile:result/@profile:time"/> ms</b></td>
<xsl:for-each select="profile:result">
<td>
<b>
<xsl:value-of select="@profile:time"/> ms
</b>
</td>
</xsl:for-each>
</tr>
</font>
</table>
</column>
</row>
</xsl:template>
<xsl:template match="profile:result" mode="result">
<row>
<column title="{../@profile:uri}">
<table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
<tr>
<td align="left"><b>Components</b></td>
<td align="left"><b>Time</b></td>
</tr>
<xsl:for-each select="profile:component">
<tr>
<td>
<a href="?key={../../@profile:key}&result={../@profile:index}&component={@profile:index}">
<xsl:value-of select="@profile:role"/>
<xsl:if test="@profile:source">
(<xsl:value-of select="@profile:source"/>)
</xsl:if>
</a>
</td>
<td>
<xsl:value-of select="@profile:time"/> ms
</td>
</tr>
</xsl:for-each>
</table>
</column>
</row>
<row>
<column title="Request parameters">
<table width="100%" cellspacing="0" cellpadding="5" align="center">
<font size="+0" face="arial,helvetica,sanserif" color="#000000">
<tr>
<td align="left"><b>Name</b></td>
<td align="left"><b>Value</b></td>
</tr>
<xsl:for-each select="profile:environmentinfo/profile:request-parameters/profile:parameter">
<tr>
<td><xsl:value-of select="@profile:name"/></td>
<td><xsl:value-of select="@profile:value"/></td>
</tr>
</xsl:for-each>
<tr>
<td> </td>
<td> </td>
</tr>
</font>
</table>
</column>
</row>
<row>
<column title="Session attributes">
<table width="100%" cellspacing="0" cellpadding="5" align="center">
<font size="+0" face="arial,helvetica,sanserif" color="#000000">
<tr>
<td align="left"><b>Name</b></td>
<td align="left"><b>Value</b></td>
</tr>
<xsl:for-each select="profile:environmentinfo/profile:session-attributes/profile:attribute">
<tr>
<td><xsl:value-of select="@profile:name"/></td>
<td><xsl:value-of select="@profile:value"/></td>
</tr>
</xsl:for-each>
<tr>
<td> </td>
<td> </td>
</tr>
</font>
</table>
</column>
</row>
</xsl:template>
<xsl:template match="profile:component" mode="fragment">
<row>
<column>
<xsl:attribute name="title">
<xsl:value-of select="@profile:role"/>
<xsl:if test="@profile:source">
(<xsl:value-of select="@profile:source"/>)
</xsl:if>
</xsl:attribute>
<xsl:choose>
<xsl:when test="profile:fragment">
<xsl:for-each select="profile:fragment">
<xsl:apply-templates mode="xml2html"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<b>Fragment not available!</b>
</xsl:otherwise>
</xsl:choose>
</column>
</row>
</xsl:template>
</xsl:stylesheet>