User: pathoss
Date: 02/04/04 13:54:57
Modified: core/samples/junit/xsl junit-frames.xsl junit-noframes.xsl
Removed: core/samples/junit/xsl overview-summary.xsl toolkit.xsl
Log:
Updated to latest version.
Revision Changes Path
1.2 +263 -131 xdoclet/core/samples/junit/xsl/junit-frames.xsl
Index: junit-frames.xsl
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/samples/junit/xsl/junit-frames.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- junit-frames.xsl 21 Feb 2002 22:04:41 -0000 1.1
+++ junit-frames.xsl 4 Apr 2002 21:54:57 -0000 1.2
@@ -2,32 +2,72 @@
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
+<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
+<xsl:decimal-format decimal-separator="." grouping-separator=","/>
+<!--
+ The Apache Software License, Version 1.1
+ Copyright (c) 2001-2002 The Apache Software Foundation. All rights
+ reserved.
-<!-- ======================================================================
-
- Stylesheet to transform an XML file generated by the Ant MAudit task into
- a set of JavaDoc-like HTML page to make pages more convenient to be browsed.
-
- It use the Xalan redirect extension to write to multiple output files.
-
- Note: HTML output can be made much more clean by removing non css attributes
-
- ====================================================================== -->
-<xsl:output method="html" indent="yes"/>
-<xsl:decimal-format decimal-separator="." grouping-separator="," />
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ 3. The end-user documentation included with the redistribution, if
+ any, must include the following acknowlegement:
+ "This product includes software developed by the
+ Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowlegement may appear in the software itself,
+ if and wherever such third-party acknowlegements normally appear.
+
+ 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ Foundation" must not be used to endorse or promote products derived
+ from this software without prior written permission. For written
+ permission, please contact [EMAIL PROTECTED]
+
+ 5. Products derived from this software may not be called "Apache"
+ nor may "Apache" appear in their names without prior written
+ permission of the Apache Group.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Apache Software Foundation. For more
+ information on the Apache Software Foundation, please see
+ <http://www.apache.org/>.
+ -->
<!--
- Xalan redirect extension writes relative file based on the parent directory
- from the main output file, unfortunately, this is never set and you have
- to do it yourself on the API. The code that does it in command line was
- commented out in Xalan 1.2.2 :-(
- Therefore I will use a stylesheet param for the output directory.
+ Sample stylesheet to be used with An JUnitReport output.
- This has to be invoked as follows from the command line:
+ It creates a set of HTML files a la javadoc where you can browse easily
+ through all packages and classes.
+
+ @author Stephane Bailliez <a href="mailto:[EMAIL PROTECTED]"/>
+ @author Erik Hatcher <a href="mailto:[EMAIL PROTECTED]"/>
- java -classpath bsf.jar;xalan.jar;xerces.jar org.apache.xalan.xslt.Process -IN
testsuites.xml -XSL maudit.xsl -PARAM output.dir './report'
-->
<xsl:param name="output.dir" select="'.'"/>
@@ -98,55 +138,65 @@
</xsl:template>
<xsl:template name="index.html">
-<HTML>
- <HEAD><TITLE>Unit Test Results.</TITLE></HEAD>
- <FRAMESET cols="20%,80%">
- <FRAMESET rows="30%,70%">
- <FRAME src="overview-frame.html" name="packageListFrame"/>
- <FRAME src="allclasses-frame.html" name="classListFrame"/>
- </FRAMESET>
- <FRAME src="overview-summary.html" name="classFrame"/>
- </FRAMESET>
+<html>
+ <head>
+ <title>Unit Test Results.</title>
+ </head>
+ <frameset cols="20%,80%">
+ <frameset rows="30%,70%">
+ <frame src="overview-frame.html" name="packageListFrame"/>
+ <frame src="allclasses-frame.html" name="classListFrame"/>
+ </frameset>
+ <frame src="overview-summary.html" name="classFrame"/>
+ </frameset>
<noframes>
- <H2>Frame Alert</H2>
- <P>
+ <h2>Frame Alert</h2>
+ <p>
This document is designed to be viewed using the frames feature. If
you see this message, you are using a non-frame-capable web client.
- </P>
+ </p>
</noframes>
-</HTML>
+</html>
</xsl:template>
-
<!-- this is the stylesheet css to use for nearly everything -->
<xsl:template name="stylesheet.css">
-BODY {
+body {
font:normal 68% verdana,arial,helvetica;
color:#000000;
}
-TD {
- FONT-SIZE: 68%
+table tr td, table tr th {
+ font-size: 68%;
+}
+table.details tr th{
+ font-weight: bold;
+ text-align:left;
+ background:#a6caf0;
}
-P {
+table.details tr td{
+ background:#eeeee0;
+}
+
+p {
line-height:1.5em;
margin-top:0.5em; margin-bottom:1.0em;
}
-H1 {
- MARGIN: 0px 0px 5px; FONT: 165% verdana,arial,helvetica
+h1 {
+ margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
}
-H2 {
- MARGIN-TOP: 1em; MARGIN-BOTTOM: 0.5em; FONT: bold 125% verdana,arial,helvetica
+h2 {
+ margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
}
-H3 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 115% verdana,arial,helvetica
+h3 {
+ margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
}
-H4 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
+h4 {
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
-H5 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
+h5 {
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
-H6 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
+h6 {
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
.Error {
font-weight:bold; color:red;
@@ -154,7 +204,9 @@
.Failure {
font-weight:bold; color:purple;
}
-
+.Properties {
+ text-align:right;
+}
</xsl:template>
@@ -165,32 +217,91 @@
====================================================================== -->
<xsl:template match="testsuite" mode="class.details">
<xsl:variable name="package.name" select="@package"/>
- <HTML>
- <HEAD>
+ <html>
+ <head>
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name"
select="$package.name"/>
</xsl:call-template>
- </HEAD>
- <BODY>
+ <script language="JavaScript">
+ var TestCases = new Array();
+ var cur;
+ <xsl:apply-templates select="properties"/>
+ </script>
+ <script language="JavaScript"><![CDATA[
+ function displayProperties (name) {
+ var win =
window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
+ var doc = win.document.open();
+ doc.write("<html><head><title>Properties of " + name + "</title>");
+ doc.write("<style>")
+ doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000;
}");
+ doc.write("table tr td, table tr th { font-size: 68%; }");
+ doc.write("table.properties { border-collapse:collapse; border-left:solid
1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
+ doc.write("table.properties th { text-align:left; border-right:solid 1
#cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
+ doc.write("table.properties td { font:normal; text-align:left;
border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc;
background-color:#fffffff; }");
+ doc.write("h3 { margin-bottom: 0.5em; font: bold 115%
verdana,arial,helvetica }");
+ doc.write("</style>");
+ doc.write("</head><body>");
+ doc.write("<h3>Properties of " + name + "</h3>");
+ doc.write("<div align=\"right\"><a
href=\"javascript:window.close();\">Close</a></div>");
+ doc.write("<table class='properties'>");
+ doc.write("<tr><th>Name</th><th>Value</th></tr>");
+ for (prop in TestCases[name]) {
+ doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] +
"</td></tr>");
+ }
+ doc.write("</table>");
+ doc.write("</body></html>");
+ doc.close();
+ win.focus();
+ }
+ ]]>
+ </script>
+ </head>
+ <body>
<xsl:call-template name="pageHeader"/>
- <H3>Class <xsl:if test="not($package.name = '')"><xsl:value-of
select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></H3>
+ <h3>Class <xsl:if test="not($package.name = '')"><xsl:value-of
select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></h3>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
+ <table class="details" border="0" cellpadding="5"
cellspacing="2" width="95%">
<xsl:call-template name="testsuite.test.header"/>
<xsl:apply-templates select="." mode="print.test"/>
</table>
- <H2>Tests</H2>
+ <h2>Tests</h2>
<p>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
+ <table class="details" border="0" cellpadding="5"
cellspacing="2" width="95%">
<xsl:call-template name="testcase.test.header"/>
+ <!--
+ test can even not be started at all (failure to load the
class)
+ so report the error directly
+ -->
+ <xsl:if test="./error">
+ <tr class="Error">
+ <td colspan="4"><xsl:apply-templates
select="./error"/></td>
+ </tr>
+ </xsl:if>
<xsl:apply-templates select="./testcase"
mode="print.test"/>
</table>
-
</p>
- </BODY>
- </HTML>
+ <div class="Properties">
+ <a>
+ <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of
select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
+ Properties »
+ </a>
+ </div>
+ </body>
+ </html>
+</xsl:template>
+
+ <!--
+ Write properties into a JavaScript data structure.
+ This is based on the original idea by Erik Hatcher ([EMAIL PROTECTED])
+ -->
+ <xsl:template match="properties">
+ cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of
select="../@name"/>'] = new Array();
+ <xsl:for-each select="property">
+ <xsl:sort select="@name"/>
+ cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template
name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>';
+ </xsl:for-each>
</xsl:template>
@@ -202,24 +313,24 @@
<!-- list of classes in a package -->
<xsl:template name="classes.list">
<xsl:param name="name"/>
- <HTML>
- <HEAD>
+ <html>
+ <head>
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$name"/>
</xsl:call-template>
- </HEAD>
- <BODY>
+ </head>
+ <body>
<table width="100%">
<tr>
<td nowrap="nowrap">
- <H2><a href="package-summary.html"
target="classFrame"><xsl:value-of select="$name"/></a></H2>
+ <h2><a href="package-summary.html"
target="classFrame"><xsl:value-of select="$name"/></a></h2>
</td>
</tr>
</table>
- <H2>Classes</H2>
+ <h2>Classes</h2>
<p>
- <TABLE WIDTH="100%">
+ <table width="100%">
<xsl:for-each select="/testsuites/testsuite[./@package
= $name]">
<xsl:sort select="@name"/>
<tr>
@@ -228,10 +339,10 @@
</td>
</tr>
</xsl:for-each>
- </TABLE>
+ </table>
</p>
- </BODY>
- </HTML>
+ </body>
+ </html>
</xsl:template>
@@ -260,7 +371,6 @@
</xsl:template>
<xsl:template match="testsuite" mode="all.classes">
- <!-- (ancestor::package)[last()] is buggy in MSXML3, fixed in SP1 ? -->
<xsl:variable name="package.name" select="@package"/>
<tr>
<td nowrap="nowrap">
@@ -295,7 +405,7 @@
<p>
<table width="100%">
<xsl:apply-templates
select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]"
mode="all.packages">
- <xsl:sort select="@name"/>
+ <xsl:sort select="@package"/>
</xsl:apply-templates>
</table>
</p>
@@ -321,7 +431,8 @@
<xsl:with-param name="package.name"/>
</xsl:call-template>
</head>
- <body onload="open('allclasses-frame.html','classListFrame')">
+ <body>
+ <xsl:attribute
name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
<xsl:call-template name="pageHeader"/>
<h2>Summary</h2>
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
@@ -329,19 +440,19 @@
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
<xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
<xsl:variable name="successRate" select="($testCount - $failureCount -
$errorCount) div $testCount"/>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
- <tr bgcolor="#A6CAF0" valign="top">
- <td><b>Tests</b></td>
- <td><b>Failures</b></td>
- <td><b>Errors</b></td>
- <td><b>Success rate</b></td>
- <td><b>Time</b></td>
+ <table class="details" border="0" cellpadding="5" cellspacing="2"
width="95%">
+ <tr valign="top">
+ <th>Tests</th>
+ <th>Failures</th>
+ <th>Errors</th>
+ <th>Success rate</th>
+ <th>Time</th>
</tr>
- <tr bgcolor="#EEEEE" valign="top">
+ <tr valign="top">
<xsl:attribute name="class">
<xsl:choose>
- <xsl:when test="$failureCount > 0">Failure</xsl:when>
<xsl:when test="$errorCount > 0">Error</xsl:when>
+ <xsl:when test="$failureCount >
0">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -364,23 +475,24 @@
<table border="0" width="95%">
<tr>
<td style="text-align: justify;">
- Note: <i>failures</i> are anticipated and checked for with assertions
while <i>errors</i> are unanticipated.
+ Note: <em>failures</em> are anticipated and checked for with
assertions while <em>errors</em> are unanticipated.
</td>
</tr>
</table>
<h2>Packages</h2>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
+ <table class="details" border="0" cellpadding="5" cellspacing="2"
width="95%">
<xsl:call-template name="testsuite.test.header"/>
<xsl:for-each select="testsuite[not(./@package =
preceding-sibling::testsuite/@package)]">
<xsl:sort select="@package" order="ascending"/>
<!-- get the node set containing all testsuites that
have the same package -->
<xsl:variable name="insamepackage"
select="/testsuites/testsuite[./@package = current()/@package]"/>
- <tr bgcolor="#EEEEE" valign="top">
+ <tr valign="top">
<!-- display a failure if there is any
failure/error in the package -->
<xsl:attribute name="class">
<xsl:choose>
- <xsl:when test="sum($insamepackage/@errors) +
sum($insamepackage/@failures) > 0">Failure</xsl:when>
+ <xsl:when
test="sum($insamepackage/@errors) > 0">Error</xsl:when>
+ <xsl:when
test="sum($insamepackage/@failures) > 0">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -403,13 +515,13 @@
<xsl:template name="package.summary">
<xsl:param name="name"/>
- <HTML>
- <HEAD>
+ <html>
+ <head>
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$name"/>
</xsl:call-template>
- </HEAD>
- <BODY>
+ </head>
+ <body>
<xsl:attribute
name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
<xsl:call-template name="pageHeader"/>
<h3>Package <xsl:value-of select="$name"/></h3>
@@ -421,9 +533,9 @@
<xsl:variable name="insamepackage"
select="/testsuites/testsuite[./@package = $name]"/>
<xsl:if test="count($insamepackage) > 0">
- <H2>Classes</H2>
+ <h2>Classes</h2>
<p>
- <table border="0" cellpadding="5" cellspacing="2"
width="95%">
+ <table class="details" border="0" cellpadding="5"
cellspacing="2" width="95%">
<xsl:call-template
name="testsuite.test.header"/>
<xsl:apply-templates select="$insamepackage"
mode="print.test">
<xsl:sort select="@name"/>
@@ -431,8 +543,8 @@
</table>
</p>
</xsl:if>
- </BODY>
- </HTML>
+ </body>
+ </html>
</xsl:template>
@@ -457,7 +569,7 @@
<!-- create the link to the stylesheet based on the package name -->
<xsl:template name="create.stylesheet.link">
<xsl:param name="package.name"/>
- <LINK REL ="stylesheet" TYPE="text/css" TITLE="Style"><xsl:attribute
name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template
name="path"><xsl:with-param name="path"
select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></LINK>
+ <link rel="stylesheet" type="text/css" title="Style"><xsl:attribute
name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template
name="path"><xsl:with-param name="path"
select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></link>
</xsl:template>
@@ -475,33 +587,33 @@
<!-- class header -->
<xsl:template name="testsuite.test.header">
- <tr bgcolor="#A6CAF0" valign="top">
- <td width="80%"><b>Name</b></td>
- <td><b>Tests</b></td>
- <td><b>Errors</b></td>
- <td><b>Failures</b></td>
- <td nowrap="nowrap"><b>Time(s)</b></td>
+ <tr valign="top">
+ <th width="80%">Name</th>
+ <th>Tests</th>
+ <th>Errors</th>
+ <th>Failures</th>
+ <th nowrap="nowrap">Time(s)</th>
</tr>
</xsl:template>
<!-- method header -->
<xsl:template name="testcase.test.header">
- <tr bgcolor="#A6CAF0" valign="top">
- <td><b>Name</b></td>
- <td><b>Status</b></td>
- <td width="80%"><b>Type</b></td>
- <td nowrap="nowrap"><b>Time(s)</b></td>
+ <tr valign="top">
+ <th>Name</th>
+ <th>Status</th>
+ <th width="80%">Type</th>
+ <th nowrap="nowrap">Time(s)</th>
</tr>
</xsl:template>
<!-- class information -->
<xsl:template match="testsuite" mode="print.test">
- <tr bgcolor="#EEEEE" valign="top">
+ <tr valign="top">
<xsl:attribute name="class">
<xsl:choose>
- <xsl:when test="@failures[.> 0]">Failure</xsl:when>
<xsl:when test="@errors[.> 0]">Error</xsl:when>
+ <xsl:when test="@failures[.> 0]">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -517,10 +629,11 @@
</xsl:template>
<xsl:template match="testcase" mode="print.test">
- <tr bgcolor="#EEEEE" valign="top">
+ <tr valign="top">
<xsl:attribute name="class">
<xsl:choose>
- <xsl:when test="failure | error">Error</xsl:when>
+ <xsl:when test="error">Error</xsl:when>
+ <xsl:when test="failure">Failure</xsl:when>
<xsl:otherwise>TableRowColor</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -558,7 +671,7 @@
<xsl:call-template name="display-failures"/>
</xsl:template>
-<!-- Style for the error and failure in the tescase template -->
+<!-- Style for the error and failure in the testcase template -->
<xsl:template name="display-failures">
<xsl:choose>
<xsl:when test="not(@message)">N/A</xsl:when>
@@ -573,10 +686,30 @@
<xsl:with-param name="word" select="."/>
</xsl:call-template>
</code>
- <!-- the later is better but might be problematic for non-21" monitors... -->
+ <!-- the latter is better but might be problematic for non-21" monitors... -->
<!--pre><xsl:value-of select="."/></pre-->
</xsl:template>
+<xsl:template name="JS-escape">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="contains($string,"'")">
+ <xsl:value-of
select="substring-before($string,"'")"/>\'<xsl:call-template
name="JS-escape">
+ <xsl:with-param name="string"
select="substring-after($string,"'")"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($string,'\')">
+ <xsl:value-of
select="substring-before($string,'\')"/>\\<xsl:call-template name="JS-escape">
+ <xsl:with-param name="string"
select="substring-after($string,'\')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
<!--
template that will convert a carriage return into a br tag
@param word the text from which to convert CR to BR tag
@@ -606,6 +739,5 @@
<xsl:param name="value"/>
<xsl:value-of select="format-number($value,'0.00%')"/>
</xsl:template>
-
</xsl:stylesheet>
1.2 +201 -92 xdoclet/core/samples/junit/xsl/junit-noframes.xsl
Index: junit-noframes.xsl
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/samples/junit/xsl/junit-noframes.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- junit-noframes.xsl 21 Feb 2002 22:04:41 -0000 1.1
+++ junit-noframes.xsl 4 Apr 2002 21:54:57 -0000 1.2
@@ -1,60 +1,112 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
+<xsl:decimal-format decimal-separator="." grouping-separator="," />
+<!--
+ The Apache Software License, Version 1.1
+ Copyright (c) 2001-2002 The Apache Software Foundation. All rights
+ reserved.
-<!-- ======================================================================
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ 3. The end-user documentation included with the redistribution, if
+ any, must include the following acknowlegement:
+ "This product includes software developed by the
+ Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowlegement may appear in the software itself,
+ if and wherever such third-party acknowlegements normally appear.
+
+ 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ Foundation" must not be used to endorse or promote products derived
+ from this software without prior written permission. For written
+ permission, please contact [EMAIL PROTECTED]
+
+ 5. Products derived from this software may not be called "Apache"
+ nor may "Apache" appear in their names without prior written
+ permission of the Apache Group.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Apache Software Foundation. For more
+ information on the Apache Software Foundation, please see
+ <http://www.apache.org/>.
+ -->
- Stylesheet to transform an XML file generated by the Ant MAudit task into
- a set of JavaDoc-like HTML page to make pages more convenient to be browsed.
+<!--
- It use the Xalan redirect extension to write to multiple output files.
+ Sample stylesheet to be used with An JUnitReport output.
- Note: HTML output can be made much more clean by removing non css attributes
+ It creates a non-framed report that can be useful to send via
+ e-mail or such.
- ====================================================================== -->
-<xsl:output method="html" indent="yes"/>
-<xsl:decimal-format decimal-separator="." grouping-separator="," />
+ @author Stephane Bailliez <a href="mailto:[EMAIL PROTECTED]"/>
+ @author Erik Hatcher <a href="mailto:[EMAIL PROTECTED]"/>
+-->
<xsl:template match="testsuites">
<HTML>
<HEAD>
<style type="text/css">
- BODY {
+ body {
font:normal 68% verdana,arial,helvetica;
color:#000000;
}
- TABLE TR TD, TABLE TR TH {
+ table tr td, table tr th {
font-size: 68%;
}
- TABLE.details TR TH{
+ table.details tr th{
font-weight: bold;
text-align:left;
- background:#A6CAF0;
+ background:#a6caf0;
}
- TABLE.details TR TD{
- background:#EEEEE0;
+ table.details tr td{
+ background:#eeeee0;
}
- P {
+ p {
line-height:1.5em;
margin-top:0.5em; margin-bottom:1.0em;
}
- H1 {
- MARGIN: 0px 0px 5px; FONT: 165% verdana,arial,helvetica
+ h1 {
+ margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
}
- H2 {
- MARGIN-TOP: 1em; MARGIN-BOTTOM: 0.5em; FONT: bold 125%
verdana,arial,helvetica
+ h2 {
+ margin-top: 1em; margin-bottom: 0.5em; font: bold 125%
verdana,arial,helvetica
}
- H3 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 115% verdana,arial,helvetica
+ h3 {
+ margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
}
- H4 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
+ h4 {
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
- H5 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
+ h5 {
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
- H6 {
- MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
+ h6 {
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
.Error {
font-weight:bold; color:red;
@@ -62,10 +114,49 @@
.Failure {
font-weight:bold; color:purple;
}
+ .Properties {
+ text-align:right;
+ }
</style>
+ <script language="JavaScript">
+ var TestCases = new Array();
+ var cur;
+ <xsl:for-each select="./testsuite">
+ <xsl:apply-templates select="properties"/>
+ </xsl:for-each>
+
+ </script>
+ <script language="JavaScript"><![CDATA[
+ function displayProperties (name) {
+ var win =
window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
+ var doc = win.document.open();
+ doc.write("<html><head><title>Properties of " + name + "</title>");
+ doc.write("<style>")
+ doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000;
}");
+ doc.write("table tr td, table tr th { font-size: 68%; }");
+ doc.write("table.properties { border-collapse:collapse; border-left:solid
1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
+ doc.write("table.properties th { text-align:left; border-right:solid 1
#cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
+ doc.write("table.properties td { font:normal; text-align:left;
border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc;
background-color:#fffffff; }");
+ doc.write("h3 { margin-bottom: 0.5em; font: bold 115%
verdana,arial,helvetica }");
+ doc.write("</style>");
+ doc.write("</head><body>");
+ doc.write("<h3>Properties of " + name + "</h3>");
+ doc.write("<div align=\"right\"><a
href=\"javascript:window.close();\">Close</a></div>");
+ doc.write("<table class='properties'>");
+ doc.write("<tr><th>Name</th><th>Value</th></tr>");
+ for (prop in TestCases[name]) {
+ doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] +
"</td></tr>");
+ }
+ doc.write("</table>");
+ doc.write("</body></html>");
+ doc.close();
+ win.focus();
+ }
+ ]]>
+ </script>
</HEAD>
<body>
- <a name="#top"></a>
+ <a name="top"></a>
<xsl:call-template name="pageHeader"/>
<!-- Summary part -->
@@ -140,7 +231,7 @@
<!-- create an anchor to this package name -->
<xsl:for-each select="/testsuites/testsuite[not(./@package =
preceding-sibling::testsuite/@package)]">
<xsl:sort select="@package"/>
- <a name="#{@package}"></a>
+ <a name="{@package}"></a>
<h3>Package <xsl:value-of select="@package"/></h3>
<table class="details" border="0" cellpadding="5"
cellspacing="2" width="95%">
@@ -159,18 +250,29 @@
<xsl:for-each select="testsuite">
<xsl:sort select="@name"/>
<!-- create an anchor to this class name -->
- <a name="#{@name}"></a>
+ <a name="{@name}"></a>
<h3>TestCase <xsl:value-of select="@name"/></h3>
<table class="details" border="0" cellpadding="5"
cellspacing="2" width="95%">
- <!-- Header -->
<xsl:call-template name="testcase.test.header"/>
-
- <!-- match the testcases of this package -->
- <xsl:apply-templates select="testcase"
mode="print.test"/>
+ <!--
+ test can even not be started at all (failure to load the
class)
+ so report the error directly
+ -->
+ <xsl:if test="./error">
+ <tr class="Error">
+ <td colspan="4"><xsl:apply-templates
select="./error"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:apply-templates select="./testcase"
mode="print.test"/>
</table>
+ <div class="Properties">
+ <a>
+ <xsl:attribute
name="href">javascript:displayProperties('<xsl:value-of
select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
+ Properties »
+ </a>
+ </div>
<p/>
- <xsl:apply-templates select="properties"/>
<a href="#top">Back to top</a>
</xsl:for-each>
@@ -223,29 +325,18 @@
</table>
</xsl:template>
- <xsl:template match="properties">
<!--
- I have NO idea how to display properties ! :-(
- It takes an incredible amount of space in the page and it's
- really unreadable.
- <xsl:variable name="count" select="count(property)"/>
- <h3>System Properties</h3>
- <table class="details" border="0" cellpadding="5" cellspacing="2"
width="95%">
- <tr valign="top">
- <th>Name</th>
- <th>Value</th>
- </tr>
+ Write properties into a JavaScript data structure.
+ This is based on the original idea by Erik Hatcher ([EMAIL PROTECTED])
+ -->
+ <xsl:template match="properties">
+ cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of
select="../@name"/>'] = new Array();
<xsl:for-each select="property">
- <tr valign="top">
- <td><xsl:value-of select="@name"/></td>
- <td><xsl:value-of select="@value"/></td>
- </tr>
+ <xsl:sort select="@name"/>
+ cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template
name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>';
</xsl:for-each>
- </table>
- -->
</xsl:template>
-
<!-- Page HEADER -->
<xsl:template name="pageHeader">
<h1>Unit Test Results</h1>
@@ -345,8 +436,6 @@
</xsl:template>
-<!-- Note : the below template error and failure are the same style
- so just call the same style store in the toolkit template -->
<xsl:template match="failure">
<xsl:call-template name="display-failures"/>
</xsl:template>
@@ -373,6 +462,26 @@
<!-- the later is better but might be problematic for non-21" monitors... -->
<!--pre><xsl:value-of select="."/></pre-->
</xsl:template>
+
+<xsl:template name="JS-escape">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="contains($string,"'")">
+ <xsl:value-of
select="substring-before($string,"'")"/>\'<xsl:call-template
name="JS-escape">
+ <xsl:with-param name="string"
select="substring-after($string,"'")"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($string,'\')">
+ <xsl:value-of
select="substring-before($string,'\')"/>\\<xsl:call-template name="JS-escape">
+ <xsl:with-param name="string"
select="substring-after($string,'\')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<!--
template that will convert a carriage return into a br tag
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel