diff options
author | Stefan Bodewig <bodewig@apache.org> | 2023-03-02 18:06:53 +0100 |
---|---|---|
committer | Stefan Bodewig <bodewig@apache.org> | 2023-03-02 18:06:53 +0100 |
commit | 60a2ab286dc3afefeafe47e56ccded74cc035a75 (patch) | |
tree | e7c4d45634cd2e4930e73e5b25bc8d83e6d16d81 | |
parent | cfbc2f7458fe5420c51250472d133b524a039cf1 (diff) | |
download | ant-60a2ab286dc3afefeafe47e56ccded74cc035a75.tar.gz |
"modernize" antunit report styelsheet
-rw-r--r-- | src/tests/antunit/junit-frames.xsl | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/src/tests/antunit/junit-frames.xsl b/src/tests/antunit/junit-frames.xsl index bbb0c7643..5732ae890 100644 --- a/src/tests/antunit/junit-frames.xsl +++ b/src/tests/antunit/junit-frames.xsl @@ -2,28 +2,26 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="http://xml.apache.org/xalan/redirect" - xmlns:stringutils="xalan://org.apache.tools.ant.util.StringUtils" + xmlns:string="xalan://java.lang.String" extension-element-prefixes="redirect"> -<xsl:output method="html" indent="yes" encoding="US-ASCII"/> +<xsl:output method="html" indent="yes" encoding="UTF-8"/> <xsl:decimal-format decimal-separator="." grouping-separator=","/> <!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> <!-- @@ -862,9 +860,11 @@ h6 { <xsl:template name="JS-escape"> <xsl:param name="string"/> - <xsl:param name="tmp1" select="stringutils:replace(string($string),'\','\\')"/> - <xsl:param name="tmp2" select="stringutils:replace(string($tmp1),"'","\'")"/> - <xsl:value-of select="$tmp2"/> + <xsl:param name="tmp1" select="string:replaceAll(string:new(string($string)),'\\','\\\\')"/> + <xsl:param name="tmp2" select="string:replaceAll(string:new(string($tmp1)),"'","\\'")"/> + <xsl:param name="tmp3" select="string:replaceAll(string:new(string($tmp2))," ",'\\n')"/> + <xsl:param name="tmp4" select="string:replaceAll(string:new(string($tmp3))," ",'\\r')"/> + <xsl:value-of select="$tmp4"/> </xsl:template> @@ -874,7 +874,35 @@ h6 { --> <xsl:template name="br-replace"> <xsl:param name="word"/> - <xsl:value-of disable-output-escaping="yes" select='stringutils:replace(string($word),"
","<br/>")'/> + <xsl:param name="splitlimit">32</xsl:param> + <xsl:variable name="secondhalfstartindex" select="(string-length($word)+(string-length($word) mod 2)) div 2"/> + <xsl:variable name="secondhalfword" select="substring($word, $secondhalfstartindex)"/> + <!-- When word is very big, a recursive replace is very heap/stack expensive, so subdivide on line break after middle of string --> + <xsl:choose> + <xsl:when test="(string-length($word) > $splitlimit) and (contains($secondhalfword, '
'))"> + <xsl:variable name="secondhalfend" select="substring-after($secondhalfword, '
')"/> + <xsl:variable name="firsthalflen" select="string-length($word) - string-length($secondhalfword)"/> + <xsl:variable name="firsthalfword" select="substring($word, 1, $firsthalflen)"/> + <xsl:variable name="firsthalfend" select="substring-before($secondhalfword, '
')"/> + <xsl:call-template name="br-replace"> + <xsl:with-param name="word" select="concat($firsthalfword,$firsthalfend)"/> + </xsl:call-template> + <br/> + <xsl:call-template name="br-replace"> + <xsl:with-param name="word" select="$secondhalfend"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($word, '
')"> + <xsl:value-of select="substring-before($word, '
')"/> + <br/> + <xsl:call-template name="br-replace"> + <xsl:with-param name="word" select="substring-after($word, '
')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$word"/> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template name="display-time"> |