stephan 2002/09/03 03:07:31 Modified: src/webapp/samples/profiler profile2html.xsl samples.xml sitemap.xmap Added: src/webapp/samples/profiler page2html.xsl profile2page.xsl test.xml test2page.xsl xml2html.css xml2html.js xml2html.xsl Log: Examples for the profiler components rewritten to show the SAX fragments, which were stored. Revision Changes Path 1.2 +82 -22 xml-cocoon2/src/webapp/samples/profiler/profile2html.xsl Index: profile2html.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/profiler/profile2html.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- profile2html.xsl 21 Aug 2002 07:30:40 -0000 1.1 +++ profile2html.xsl 3 Sep 2002 10:07:31 -0000 1.2 @@ -18,17 +18,17 @@ <table noshade="noshade" border="0" cellspacing="1" cellpadding="0" width="100%"> <xsl:choose> <xsl:when test="$sort = 'uri'"> - <xsl:apply-templates> + <xsl:apply-templates select="profile:pipeline"> <xsl:sort select="@profile:uri"/> </xsl:apply-templates> </xsl:when> <xsl:when test="$sort = 'time'"> - <xsl:apply-templates> + <xsl:apply-templates select="profile:pipeline"> <xsl:sort select="@profile:time" data-type="number"/> </xsl:apply-templates> </xsl:when> <xsl:when test="$sort = 'count'"> - <xsl:apply-templates> + <xsl:apply-templates select="profile:pipeline"> <xsl:sort select="@profile:count" data-type="number"/> </xsl:apply-templates> </xsl:when> @@ -37,6 +37,8 @@ </xsl:otherwise> </xsl:choose> </table> + + <xsl:apply-templates select="profile:pipeline/profile:result/profile:environmentinfo"/> </body> </html> </xsl:template> @@ -51,23 +53,24 @@ </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 colspan="3"> + <a href="?key={@profile:key}"> + <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"/>) + </a> </td> - </tr> -<!-- - <xsl:for-each select="*"> - <tr> + <xsl:for-each select="profile:result"> <td> - <xsl:apply-templates select="."/> + <a href="?key={../@profile:key}&index={@profile:index}"> + <xsl:value-of select="@profile:index"/> + </a> </td> - </tr> - </xsl:for-each> ---> - <xsl:for-each select="profile:average/profile:element"> + </xsl:for-each> + </tr> + + <xsl:for-each select="profile:average/profile:component"> <xsl:variable name="bgcolor"> <xsl:if test="position() mod 2 = 0">#D0D0D0</xsl:if> <xsl:if test="position() mod 2 = 1">#E0E0E0</xsl:if> @@ -85,22 +88,24 @@ </xsl:if> </td> - <xsl:for-each select="../../profile:average/profile:element[position()=$pos]"> + <xsl:for-each select="../../profile:average/profile:component[position()=$pos]"> <th> <xsl:value-of select="@profile:time"/> </th> </xsl:for-each> - <xsl:for-each select="../../profile:result/profile:element[position()=$pos]"> + <xsl:for-each select="../../profile:result/profile:component[position()=$pos]"> <td> - <xsl:value-of select="@profile:time"/> + <a href="?key={../../@profile:key}&index={../@profile:index}&offset={@profile:offset}"> + <xsl:value-of select="@profile:time"/> + </a> </td> </xsl:for-each> </tr> </xsl:for-each> - <xsl:variable name="pos" select="count(profile:average/profile:element)"/> + <xsl:variable name="pos" select="count(profile:average/profile:component)"/> <tr> <td width="1%"> <xsl:value-of select="$pos+1"/> @@ -126,7 +131,7 @@ <xsl:apply-templates/> </xsl:template> - <xsl:template match="profile:element"> + <xsl:template match="profile:component"> <table cellspacing="0" cellpadding="0"> <tr> <td> @@ -134,6 +139,61 @@ </td> </tr> </table> + </xsl:template> + + <xsl:template match="profile:environmentinfo"> + <xsl:apply-templates select="profile:request-parameters"/> + <xsl:apply-templates select="profile:session-attributes"/> + </xsl:template> + + <xsl:template match="profile:request-parameters"> + <table> + <tr bgcolor="#C0C0FF"> + <th colspan="14"> + Request parameters + </th> + </tr> + <tr bgcolor="#FFC0C0"> + <th>Name</th> + <th>Value</th> + </tr> + <xsl:for-each select="profile:parameter"> + <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}"> + <td><xsl:value-of select="@profile:name"/></td> + <td><xsl:value-of select="@profile:value"/></td> + </tr> + </xsl:for-each> + </table> + </xsl:template> + + <xsl:template match="profile:session-attributes"> + <table> + <tr bgcolor="#C0C0FF"> + <th colspan="14"> + Session attributes + </th> + </tr> + <tr bgcolor="#FFC0C0"> + <th>Name</th> + <th>Value</th> + </tr> + <xsl:for-each select="profile:attribute"> + <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}"> + <td><xsl:value-of select="@profile:name"/></td> + <td><xsl:value-of select="@profile:value"/></td> + </tr> + </xsl:for-each> + </table> </xsl:template> </xsl:stylesheet> 1.2 +4 -2 xml-cocoon2/src/webapp/samples/profiler/samples.xml Index: samples.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/profiler/samples.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- samples.xml 21 Aug 2002 07:30:40 -0000 1.1 +++ samples.xml 3 Sep 2002 10:07:31 -0000 1.2 @@ -13,9 +13,11 @@ </group> <group name="Profiler"> - <sample name="Profiler Result" href="profiler.html">Shows the result of the profiler.</sample> + <sample name="Profiler Result" href="profile.html">Shows the result of the profiler.</sample> - <sample name="XML Output" href="profiler.xml">Show source xml code of the profiler generator.</sample> + <sample name="Profiler Result 2" href="profile2.html">Another view of the results.</sample> + + <sample name="XML Output" href="profile.xml">Show source xml code of the profiler generator.</sample> </group> </samples> 1.2 +48 -22 xml-cocoon2/src/webapp/samples/profiler/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/profiler/sitemap.xmap,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sitemap.xmap 21 Aug 2002 07:30:40 -0000 1.1 +++ sitemap.xmap 3 Sep 2002 10:07:31 -0000 1.2 @@ -39,24 +39,13 @@ <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:generate src="test.xml"/> + <map:transform src="test2page.xsl"/> + <map:transform src="page2html.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"/> @@ -69,32 +58,69 @@ <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:generate src="test.xml"/> + <map:transform src="test2page.xsl"/> + <map:transform src="page2html.xsl"/> <map:serialize type="html"/> </map:match> -<!-- =========================== Profiler ================================ --> + <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:match pattern="profiler.html"> +<!-- =========================== Profiler ================================= --> + + <map:pipeline type="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="profile.html"> <map:generate type="profiler"/> - <map:transform src="profile2html.xsl"/> + <map:transform src="profile2page.xsl"> + <map:parameter name="use-request-parameters" value="true"/> + </map:transform> + <map:transform src="page2html.xsl"/> <map:serialize type="html"/> </map:match> - <map:match pattern="profiler.xml"> + <map:match pattern="profile2.html"> + <map:generate type="profiler"/> + <map:transform src="profile2html.xsl"> + <map:parameter name="use-request-parameters" value="true"/> + </map:transform> + <map:serialize type="html"/> + </map:match> + + <map:match pattern="profile.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:match pattern="*.css"> + <map:read src="{1}.css" mime-type="text/css"/> + </map:match> + <map:match pattern="*.js"> + <map:read src="{1}.js" mime-type="text/javascript"/> + </map:match> + <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> 1.1 xml-cocoon2/src/webapp/samples/profiler/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 @version@</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 @version@</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 © @year@ <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-cocoon2/src/webapp/samples/profiler/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"/></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> 1.1 xml-cocoon2/src/webapp/samples/profiler/test.xml Index: test.xml =================================================================== <hello-world> <title>Title of the example</title> <some-text>This is a litte test file!</some-text> <some-text>And will transformed into a HTML page.</some-text> </hello-world> 1.1 xml-cocoon2/src/webapp/samples/profiler/test2page.xsl Index: test2page.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="hello-world"> <page> <tab title="Overview" href="welcome"/> <row> <column title="{title}"> <xsl:apply-templates select="some-text"/> </column> </row> </page> </xsl:template> <xsl:template match="some-text"> <p> <xsl:apply-templates/> </p> </xsl:template> </xsl:stylesheet> 1.1 xml-cocoon2/src/webapp/samples/profiler/xml2html.css Index: xml2html.css =================================================================== BODY {font:x-small 'Verdana'; margin-right:1.5em} .c {cursor:hand} .b {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none} .e {margin-left:1em; text-indent:-1em; margin-right:1em} .k {margin-left:1em; text-indent:-1em; margin-right:1em} .t {color:#990000} .xt {color:#990099} .ns {color:red} .dt {color:green} .m {color:blue} .tx {font-weight:bold} .db {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px;padding-left:.3em; border-left:1px solid #CCCCCC; font:small Courier} .di {font:small Courier} .d {color:blue} .pi {color:blue} .cb {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px;padding-left:.3em; font:small Courier; color:#888888} .ci {font:small Courier; color:#888888} PRE {margin:0px; display:inline} 1.1 xml-cocoon2/src/webapp/samples/profiler/xml2html.js Index: xml2html.js =================================================================== //MSIE function f(e){ if (e.className=="ci") { if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb"); } if (e.className=="di") { if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db"); } e.id=""; } function fix(e,cl){ e.className=cl; e.style.display="block"; j=e.parentElement.children(0); j.className="c"; k=j.children(0); k.style.visibility="visible"; k.href="#"; } function ch(e) { mark=e.children(0).children(0); if (mark.innerText=="+") { mark.innerText="-"; for (var i=1;i<e.children.length;i++) { e.children(i).style.display="block"; } } else if (mark.innerText=="-") { mark.innerText="+"; for (var i=1;i<e.children.length;i++) { e.children(i).style.display="none"; } } } function ch2(e) { mark=e.children(0).children(0); contents=e.children(1); if (mark.innerText=="+") { mark.innerText="-"; if (contents.className=="db"||contents.className=="cb") { contents.style.display="block"; } else { contents.style.display="inline"; } } else if (mark.innerText=="-") { mark.innerText="+"; contents.style.display="none"; } } function cl() { e=window.event.srcElement; if (e.className!="c") { e=e.parentElement; if (e.className!="c") { return; } } e=e.parentElement; if (e.className=="e") { ch(e); } if (e.className=="k") { ch2(e); } } //mozilla function moz_f(){ clean=document.getElementsByName('clean'); for(i=0; i<clean.length;i++) { e = clean[i]; if (e.className=="ci") { if (e.childNodes[1].childNodes[0].nodeValue.indexOf("\n")>0) moz_fix(e,"cb"); } if (e.className=="di") { if (e.childNodes[1].nodeValue.indexOf("\n")>0) moz_fix(e,"db"); } } } function moz_fix(e,cl){ e.className=cl; e.style.display="block"; j=e.parentNode.childNodes[1]; j.className="c"; k=j.childNodes[0]; k.style.visibility="visible"; k.href="#"; } function moz_ch(e) { mark = e.childNodes[1].childNodes[1]; if (mark.childNodes[0].nodeValue=="+") { mark.childNodes[0].nodeValue="-"; for (var i=2;i<e.childNodes.length;i++) { if(e.childNodes[i].nodeName != "#text") e.childNodes[i].style.display="block"; } } else if (mark.childNodes[0].nodeValue=="-") { mark.childNodes[0].nodeValue="+"; for (var i=2;i<e.childNodes.length;i++) { if(e.childNodes[i].nodeName != "#text") e.childNodes[i].style.display="none"; } } } function moz_ch2(e) { mark = e.childNodes[1].childNodes[0]; contents=e.childNodes[2]; if (mark.childNodes[0].nodeValue=="+") { mark.childNodes[0].nodeValue="-"; if (contents.className=="db"||contents.className=="cb") { contents.style.display="block"; } else { contents.style.display="inline"; } } else if (mark.childNodes[0].nodeValue=="-") { mark.childNodes[0].nodeValue="+"; contents.style.display="none"; } } function moz_cl(evnt) { e=evnt.target.parentNode; if (e.className != "c") { e=e.parentNode if (e.className!="c") { return; } } e=e.parentNode if (e.className=="e") { moz_ch(e); } if (e.className=="k") { moz_ch2(e); } } function ex(){} function h(){window.status=" ";} if(document.all) document.onclick=cl; else if(document.getElementById) document.onclick=moz_cl; 1.1 xml-cocoon2/src/webapp/samples/profiler/xml2html.xsl Index: xml2html.xsl =================================================================== <!-- | | XSLT REC Compliant Version of IE5 Default Stylesheet | | Original version by Jonathan Marsh ([EMAIL PROTECTED]) | http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl | | Conversion to XSLT 1.0 REC Syntax by Steve Muench ([EMAIL PROTECTED]) | Added script support by Andrew Timberlake ([EMAIL PROTECTED]) | +--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="processing-instruction()" mode="xml2html"> <DIV class="e"> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"> <xsl:text><?</xsl:text> </SPAN> <SPAN class="pi"> <xsl:value-of select="name(.)"/> <xsl:value-of select="."/> </SPAN> <SPAN class="m"> <xsl:text>?></xsl:text> </SPAN> </DIV> </xsl:template> <xsl:template match="processing-instruction('xml')" mode="xml2html"> <DIV class="e"> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"> <xsl:text><?</xsl:text> </SPAN> <SPAN class="pi"> <xsl:text>xml </xsl:text> <xsl:for-each select="@*"> <xsl:value-of select="name(.)"/> <xsl:text>="</xsl:text> <xsl:value-of select="."/> <xsl:text>" </xsl:text> </xsl:for-each> </SPAN> <SPAN class="m"> <xsl:text>?></xsl:text> </SPAN> </DIV> </xsl:template> <xsl:template match="@*" mode="xml2html"> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*/@*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> </SPAN> <SPAN class="m">="</SPAN> <B> <xsl:value-of select="."/> </B> <SPAN class="m">"</SPAN> <xsl:if test="position()!=last()"> <xsl:text> </xsl:text> </xsl:if> </xsl:template> <xsl:template match="text()" mode="xml2html"> <DIV class="e"> <SPAN class="b"> </SPAN> <SPAN class="tx"> <xsl:value-of select="."/> </SPAN> </DIV> </xsl:template> <xsl:template match="comment()" mode="xml2html"> <DIV class="k"> <SPAN> <A STYLE="visibility:hidden" class="b" onclick="return false" onfocus="h()">-</A> <SPAN class="m"> <xsl:text><!--</xsl:text> </SPAN> </SPAN> <SPAN class="ci" id="clean"> <PRE> <xsl:value-of select="."/> </PRE> </SPAN> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"> <xsl:text>--></xsl:text> </SPAN> <SCRIPT>if(document.all)f(clean);</SCRIPT> </DIV> </xsl:template> <xsl:template match="*" mode="xml2html"> <DIV class="e"> <DIV STYLE="margin-left:1em;text-indent:-2em"> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"><</SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> <xsl:if test="@*"> <xsl:text> </xsl:text> </xsl:if> </SPAN> <xsl:apply-templates select="@*" mode="xml2html"/> <SPAN class="m"> <xsl:text>/></xsl:text> </SPAN> </DIV> </DIV> </xsl:template> <xsl:template match="*[node()]" mode="xml2html"> <DIV class="e"> <DIV class="c"> <A class="b" href="#" onclick="return false" onfocus="h()">-</A> <SPAN class="m"><</SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> <xsl:if test="@*"> <xsl:text> </xsl:text> </xsl:if> </SPAN> <xsl:apply-templates select="@*" mode="xml2html"/> <SPAN class="m"> <xsl:text>></xsl:text> </SPAN> </DIV> <DIV> <xsl:apply-templates mode="xml2html"/> <DIV> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"> <xsl:text></</xsl:text> </SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> </SPAN> <SPAN class="m"> <xsl:text>></xsl:text> </SPAN> </DIV> </DIV> </DIV> </xsl:template> <xsl:template match="*[text() and not (comment() or processing-instruction())]" mode="xml2html"> <DIV class="e"> <DIV STYLE="margin-left:1em;text-indent:-2em"> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"> <xsl:text><</xsl:text> </SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> <xsl:if test="@*"> <xsl:text> </xsl:text> </xsl:if> </SPAN> <xsl:apply-templates select="@*" mode="xml2html"/> <SPAN class="m"> <xsl:text>></xsl:text> </SPAN> <SPAN class="tx"> <xsl:value-of select="."/> </SPAN> <SPAN class="m"></</SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> </SPAN> <SPAN class="m"> <xsl:text>></xsl:text> </SPAN> </DIV> </DIV> </xsl:template> <xsl:template match="*[*]" priority="20" mode="xml2html"> <DIV class="e"> <DIV STYLE="margin-left:1em;text-indent:-2em" class="c"> <A class="b" href="#" onclick="return false" onfocus="h()">-</A> <SPAN class="m"><</SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> <xsl:if test="@*"> <xsl:text> </xsl:text> </xsl:if> </SPAN> <xsl:apply-templates select="@*" mode="xml2html"/> <SPAN class="m"> <xsl:text>></xsl:text> </SPAN> </DIV> <DIV> <xsl:apply-templates mode="xml2html"/> <DIV> <SPAN class="b"> <xsl:call-template name="nbsp-ref"/> </SPAN> <SPAN class="m"> <xsl:text></</xsl:text> </SPAN> <SPAN> <xsl:attribute name="class"> <xsl:if test="xsl:*"> <xsl:text>x</xsl:text> </xsl:if> <xsl:text>t</xsl:text> </xsl:attribute> <xsl:value-of select="name(.)"/> </SPAN> <SPAN class="m"> <xsl:text>></xsl:text> </SPAN> </DIV> </DIV> </DIV> </xsl:template> <xsl:template name="nbsp-ref"> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]