stephan 2002/08/21 00:30:41 Modified: src/webapp/samples samples.xml Added: src/webapp/samples/profiler profile2html.xsl samples.xml sitemap.xmap Log: Add a new samples section for the profiler components. Revision Changes Path 1.1 xml-cocoon2/src/webapp/samples/profiler/profile2html.xsl Index: profile2html.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:param name="sort"/> <xsl:template match="profile:profilerinfo"> <html> <head> <title>Cocoon2 profile information [<xsl:value-of select="@profile:date"/>]</title> </head> <body> Sort results by <a href="?sort=uri">uri</a>, <a href="?sort=count">count</a>, <a href="?sort=time">time</a>. <table noshade="noshade" border="0" cellspacing="1" cellpadding="0" width="100%"> <xsl:choose> <xsl:when test="$sort = 'uri'"> <xsl:apply-templates> <xsl:sort select="@profile:uri"/> </xsl:apply-templates> </xsl:when> <xsl:when test="$sort = 'time'"> <xsl:apply-templates> <xsl:sort select="@profile:time" data-type="number"/> </xsl:apply-templates> </xsl:when> <xsl:when test="$sort = 'count'"> <xsl:apply-templates> <xsl:sort select="@profile:count" data-type="number"/> </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </table> </body> </html> </xsl:template> <xsl:template match="profile:pipeline"> <xsl:if test="position() mod 5 = 1"> <tr bgcolor="#FFC0C0"> <th>NN</th> <th>Role (Source)</th> <th>Average</th> <th colspan="10">Last Results</th> </tr> </xsl:if> <tr bgcolor="#C0C0FF"> <td colspan="14"> <font face="verdana"><strong><xsl:value-of select="@profile:uri"/></strong></font> (<xsl:value-of select="@profile:count"/> results, total time: <xsl:value-of select="@profile:time"/>, average time: <xsl:value-of select="@profile:time div @profile:count"/>) </td> </tr> <!-- <xsl:for-each select="*"> <tr> <td> <xsl:apply-templates select="."/> </td> </tr> </xsl:for-each> --> <xsl:for-each select="profile:average/profile:element"> <xsl:variable name="bgcolor"> <xsl:if test="position() mod 2 = 0">#D0D0D0</xsl:if> <xsl:if test="position() mod 2 = 1">#E0E0E0</xsl:if> </xsl:variable> <tr bgcolor="{$bgcolor}"> <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:element[position()=$pos]"> <th> <xsl:value-of select="@profile:time"/> </th> </xsl:for-each> <xsl:for-each select="../../profile:result/profile:element[position()=$pos]"> <td> <xsl:value-of select="@profile:time"/> </td> </xsl:for-each> </tr> </xsl:for-each> <xsl:variable name="pos" select="count(profile:average/profile:element)"/> <tr> <td width="1%"> <xsl:value-of select="$pos+1"/> </td> <td width="10%"> TOTAL </td> <th> <xsl:value-of select="profile:average/@profile:time"/> </th> <xsl:for-each select="profile:result"> <td> <xsl:value-of select="@profile:time"/> </td> </xsl:for-each> </tr> </xsl:template> <xsl:template match="profile:average|profile:result"> <xsl:apply-templates/> </xsl:template> <xsl:template match="profile:element"> <table cellspacing="0" cellpadding="0"> <tr> <td> <xsl:value-of select="@profile:role"/> </td> </tr> </table> </xsl:template> </xsl:stylesheet> 1.1 xml-cocoon2/src/webapp/samples/profiler/samples.xml Index: samples.xml =================================================================== <?xml version="1.0" encoding="iso-8859-1"?> <samples xmlns:xlink="http://www.w3.org/1999/xlink"> <group name="Main examples page."> <sample name="Back" href="..">to Cocoon examples main page</sample> </group> <group name="Test"> <sample name="Caching test site" href="caching-testsite.html">A simple test side perform the profiling. Is show the current sitemap.</sample> <sample name="Non Caching test site" href="noncaching-testsite.html">The same site, but this will not be cached.</sample> </group> <group name="Profiler"> <sample name="Profiler Result" href="profiler.html">Shows the result of the profiler.</sample> <sample name="XML Output" href="profiler.xml">Show source xml code of the profiler generator.</sample> </group> </samples> 1.1 xml-cocoon2/src/webapp/samples/profiler/sitemap.xmap Index: sitemap.xmap =================================================================== <?xml version="1.0"?> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <map:components> <map:generators default="file"> </map:generators> <map:transformers default="xslt"> </map:transformers> <map:readers default="resource"> </map:readers> <map:serializers default="html"> </map:serializers> <map:matchers default="wildcard"> </map:matchers> <map:selectors default="browser"> </map:selectors> <map:actions> </map:actions> <map:pipelines default="caching"> </map:pipelines> </map:components> <!-- =========================== Pipelines ================================= --> <map:pipelines> <!-- =========================== Cacheable ================================= --> <map:pipeline type="profile-caching"> <map:match pattern=""> <map:redirect-to uri="welcome"/> </map:match> <map:match pattern="welcome"> <map:generate src="samples.xml"/> <map:transform src="context://samples/stylesheets/simple-samples2html.xsl"/> <map:serialize/> </map:match> <map:match pattern="caching-testsite.html"> <map:generate src="sitemap.xmap"/> <map:transform src="context://samples/common/style/xsl/html/simple-xml2html.xsl"/> <map:serialize type="html"/> </map:match> <!-- =========================== Errors ================================ --> <map:handle-errors> <map:transform src="context://samples/common/style/xsl/html/error2html.xsl"/> <map:serialize type="html" status-code="500"/> </map:handle-errors> </map:pipeline> <!-- =========================== Noncacheable ================================= --> <map:pipeline type="profile-noncaching"> <map:match pattern="noncaching-testsite.html"> <map:generate src="sitemap.xmap"/> <map:transform src="context://samples/common/style/xsl/html/simple-xml2html.xsl"/> <map:serialize type="html"/> </map:match> <!-- =========================== Profiler ================================ --> <map:match pattern="profiler.html"> <map:generate type="profiler"/> <map:transform src="profile2html.xsl"/> <map:serialize type="html"/> </map:match> <map:match pattern="profiler.xml"> <map:generate type="profiler"/> <map:transform src="context://samples/common/style/xsl/html/simple-xml2html.xsl"/> <map:serialize type="html"/> </map:match> <!-- =========================== Errors ================================ --> <map:handle-errors> <map:transform src="context://samples/common/style/xsl/html/error2html.xsl"/> <map:serialize type="html" status-code="500"/> </map:handle-errors> </map:pipeline> </map:pipelines> </map:sitemap> 1.23 +5 -1 xml-cocoon2/src/webapp/samples/samples.xml Index: samples.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/samples.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- samples.xml 15 Aug 2002 14:26:43 -0000 1.22 +++ samples.xml 21 Aug 2002 07:30:41 -0000 1.23 @@ -72,6 +72,10 @@ <sample name="Error Page" href="system/generror.html"> This example shows what happens if an error is triggered in the pipeline. </sample> + + <sample name="Profiler" href="profiler/welcome"> + This example shows the usage of the Profiler components. + </sample> </group> <group name="Control flow">
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]