Browse Source

- Fixed JavaScript escaping for properties.

- Added copyright
Submitted by: K.C. Baltz, kbaltz@mail.responsenetworks.com


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271190 13f79535-47bb-0310-9956-ffa450edef68
master
Stephane Bailliez 23 years ago
parent
commit
91dfa2e783
2 changed files with 136 additions and 37 deletions
  1. +67
    -30
      src/etc/junit-frames.xsl
  2. +69
    -7
      src/etc/junit-noframes.xsl

+ 67
- 30
src/etc/junit-frames.xsl View File

@@ -2,32 +2,72 @@
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">


<!-- ======================================================================

Stylesheet to transform an XML file generated by the Ant JUnit 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=","/>
<!--
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 apache@apache.org.

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.
This has to be invoked as follows from the command line:
java -classpath bsf.jar;xalan.jar;xerces.jar org.apache.xalan.xslt.Process -IN testsuites.xml -XSL junit-frames.xsl -PARAM output.dir './report'
Sample stylesheet to be used with An JUnitReport output.
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:sbailliez@apache.org"/>
@author Erik Hatcher <a href="mailto:ehatcher@apache.org"/>
-->
<xsl:param name="output.dir" select="'.'"/>

@@ -331,7 +371,6 @@ h6 {
</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">
@@ -653,14 +692,12 @@ h6 {

<xsl:template name="JS-escape">
<xsl:param name="string"/>
<xsl:choose><!-- something isn't right here, basically all single quotes need to be replaced with backslash-single-quote
<xsl:when test="contains($string,'&apos;')">
<xsl:value-of select="substring-before($string,'&apos;')"/>
\&apos;
<xsl:call-template name="JS-escape">
<xsl:with-param name="string" select="substring-after($string,'&apos;')"/>
<xsl:choose>
<xsl:when test="contains($string,&quot;'&quot;)">
<xsl:value-of select="substring-before($string,&quot;'&quot;)"/>\&apos;<xsl:call-template name="JS-escape">
<xsl:with-param name="string" select="substring-after($string,&quot;'&quot;)"/>
</xsl:call-template>
</xsl:when> -->
</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,'\')"/>


+ 69
- 7
src/etc/junit-noframes.xsl View File

@@ -1,7 +1,71 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<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 apache@apache.org.

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/>.
-->
<!--
Sample stylesheet to be used with An JUnitReport output.
It creates a non-framed report that can be useful to send via
e-mail or such.
@author Stephane Bailliez <a href="mailto:sbailliez@apache.org"/>
@author Erik Hatcher <a href="mailto:ehatcher@apache.org"/>
-->
<xsl:template match="testsuites">
<HTML>
<HEAD>
@@ -401,14 +465,12 @@

<xsl:template name="JS-escape">
<xsl:param name="string"/>
<xsl:choose><!-- something isn't right here, basically all single quotes need to be replaced with backslash-single-quote
<xsl:when test="contains($string,'&apos;')">
<xsl:value-of select="substring-before($string,'&apos;')"/>
\&apos;
<xsl:call-template name="JS-escape">
<xsl:with-param name="string" select="substring-after($string,'&apos;')"/>
<xsl:choose>
<xsl:when test="contains($string,&quot;'&quot;)">
<xsl:value-of select="substring-before($string,&quot;'&quot;)"/>\&apos;<xsl:call-template name="JS-escape">
<xsl:with-param name="string" select="substring-after($string,&quot;'&quot;)"/>
</xsl:call-template>
</xsl:when> -->
</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,'\')"/>


Loading…
Cancel
Save