Просмотр исходного кода

make toolset names breakable

[SVN r23343]
Aleksey Gurtovoy 22 лет назад
Родитель
Сommit
383bf5cb2b

+ 115 - 108
tools/regression/xsl_reports/xsl/common.xsl

@@ -9,73 +9,82 @@
 
 -->
 
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  xmlns:exsl="http://exslt.org/common"
-  xmlns:func="http://exslt.org/functions"
-  xmlns:meta="http://www.meta-comm.com"
-  extension-element-prefixes="func"
-  version="1.0">
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:exsl="http://exslt.org/common"
+    xmlns:func="http://exslt.org/functions"
+    xmlns:str="http://exslt.org/strings"
+    xmlns:meta="http://www.meta-comm.com"
+    extension-element-prefixes="func"
+    version="1.0">
 
-  <xsl:variable name="output_directory" select="'output'"/>
+    <xsl:import href="exslt/str.xsl"/>
 
-  <xsl:template name="get_toolsets">
+    <xsl:variable name="output_directory" select="'output'"/>
+
+    <xsl:template name="get_toolsets">
     <xsl:param name="toolsets"/>
     <xsl:param name="required-toolsets"/>
-    
+
     <xsl:variable name="toolset_output">
-      <xsl:for-each select="$toolsets">
+        <xsl:for-each select="$toolsets">
         <xsl:variable name="toolset" select="."/>
         <xsl:element name="toolset">
-          <xsl:attribute name="toolset"><xsl:value-of select="$toolset"/></xsl:attribute>
-          <xsl:choose>
+            <xsl:attribute name="toolset"><xsl:value-of select="$toolset"/></xsl:attribute>
+            <xsl:choose>
             <xsl:when test="$required_toolsets[ $toolset = @name ]">
-              <xsl:attribute name="required">yes</xsl:attribute>
-              <xsl:attribute name="sort">a</xsl:attribute>
+                <xsl:attribute name="required">yes</xsl:attribute>
+                <xsl:attribute name="sort">a</xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
-              <xsl:attribute name="required">no</xsl:attribute>
-              <xsl:attribute name="sort">z</xsl:attribute>
+                <xsl:attribute name="required">no</xsl:attribute>
+                <xsl:attribute name="sort">z</xsl:attribute>
             </xsl:otherwise>
-          </xsl:choose>
+            </xsl:choose>
         </xsl:element>
-      </xsl:for-each>
+        </xsl:for-each>
     </xsl:variable>
-    
+
     <xsl:for-each select="exsl:node-set( $toolset_output )/toolset">
-      <xsl:sort select="concat( @sort, ' ', @toolset)" order="ascending"/>
-      <xsl:copy-of select="."/>
+        <xsl:sort select="concat( @sort, ' ', @toolset)" order="ascending"/>
+        <xsl:copy-of select="."/>
     </xsl:for-each>
-    
-  </xsl:template>
-
-  <func:function name="meta:is_test_log_a_test_case">
-      <xsl:param name="test_log"/>      
-      <func:result select="$test_log/@test-type='compile' or $test_log/@test-type='compile_fail' or $test_log/@test-type='run' or $test_log/@test-type='run_pyd'"/>
-  </func:function>
-
-  <func:function name="meta:is_unusable">
-      <xsl:param name="explicit_markup"/>
-      <xsl:param name="library"/>
-      <xsl:param name="toolset"/>
-      
-      <func:result select="$explicit_markup//library[ @name = $library ]/mark-unusable[ toolset/@name = $toolset or toolset/@name='*' ]"/>
-  </func:function>
-
-  <func:function name="meta:encode_path">
-      <xsl:param name="path"/>
-      <func:result select="translate( translate( $path, '/', '-' ), './', '-' )"/>
-  </func:function>
-
-  <func:function name="meta:output_file_path">
-      <xsl:param name="path"/>
-      <func:result select="concat( $output_directory, '/', meta:encode_path( $path ), '.html' )"/>
-  </func:function>
-
-  <xsl:template name="show_notes">
-      <xsl:param name="explicit_markup"/>
-      <xsl:param name="notes"/>
+
+    </xsl:template>
+
+    <func:function name="meta:is_test_log_a_test_case">
+        <xsl:param name="test_log"/>      
+        <func:result select="$test_log/@test-type='compile' or $test_log/@test-type='compile_fail' or $test_log/@test-type='run' or $test_log/@test-type='run_pyd'"/>
+    </func:function>
+
+    <func:function name="meta:is_unusable">
+        <xsl:param name="explicit_markup"/>
+        <xsl:param name="library"/>
+        <xsl:param name="toolset"/>
+        
+        <func:result select="$explicit_markup//library[ @name = $library ]/mark-unusable[ toolset/@name = $toolset or toolset/@name='*' ]"/>
+    </func:function>
+
+    <func:function name="meta:encode_path">
+        <xsl:param name="path"/>
+        <func:result select="translate( translate( $path, '/', '-' ), './', '-' )"/>
+    </func:function>
+
+    <func:function name="meta:toolset_name">
+        <xsl:param name="name"/>
+        <func:result select="str:replace( $name, '-', '- ' )"/>
+    </func:function>
+
+    <func:function name="meta:output_file_path">
+        <xsl:param name="path"/>
+        <func:result select="concat( $output_directory, '/', meta:encode_path( $path ), '.html' )"/>
+    </func:function>
+
+    <xsl:template name="show_notes">
+        <xsl:param name="explicit_markup"/>
+        <xsl:param name="notes"/>
         <div class="notes">
-          <xsl:for-each select="$notes">
+            <xsl:for-each select="$notes">
             <div>
                 <xsl:variable name="refid" select="@refid"/>
                 <xsl:call-template name="show_note">
@@ -83,64 +92,62 @@
                     <xsl:with-param name="reference" select="$explicit_markup//note[ $refid = @id ]"/>
                 </xsl:call-template>
             </div>
-          </xsl:for-each>
+            </xsl:for-each>
         </div>
-  </xsl:template>
-
-  <xsl:template name="show_note">
-      <xsl:param name="note"/>
-      <xsl:param name="reference"/>
-      <div class="note">
-          <xsl:variable name="author">
-              <xsl:choose>
-                  <xsl:when test="$note/@author">
-                      <xsl:value-of select="$note/@author"/>
-                  </xsl:when>
-                  <xsl:when test="$reference">
-                      <xsl:value-of select="$reference/@author"/>                               
-                  </xsl:when>
-                  <xsl:otherwise>
-                      <xsl:text/>
-                  </xsl:otherwise>
-              </xsl:choose>
-          </xsl:variable>
-
-          <xsl:variable name="date">
-              <xsl:choose>
-                  <xsl:when test="$note/@date">
-                      <xsl:value-of select="$note/@date"/>
-                  </xsl:when>
-                  <xsl:when test="$reference">
-                      <xsl:value-of select="$reference/@date"/>                      
-                  </xsl:when>
-                  <xsl:otherwise>
-                      <xsl:text/>
-                  </xsl:otherwise>
-              </xsl:choose>
-          </xsl:variable>
-
-      <span class="note-header">
-          <xsl:choose>
-              <xsl:when test="$author != '' and $date != ''">
-                  [&#160;<xsl:value-of select="$author"/>&#160;<xsl:value-of select="$date"/>&#160;]
-              </xsl:when>
-              <xsl:when test="$author != ''">
-                  [&#160;<xsl:value-of select="$author"/>&#160;]                        
-              </xsl:when>
-              <xsl:when test="$date != ''">
-                  [&#160;<xsl:value-of select="$date"/>&#160;]                        
-              </xsl:when>
-          </xsl:choose>
-      </span>
-
-      <xsl:if test="$reference">
-          <xsl:copy-of select="$reference/node()"/>                
-      </xsl:if>
-      <xsl:copy-of select="$note/node()"/>      
-
-      </div>
-  </xsl:template>
-
+    </xsl:template>
+
+    <xsl:template name="show_note">
+        <xsl:param name="note"/>
+        <xsl:param name="reference"/>
+        <div class="note">
+            <xsl:variable name="author">
+                <xsl:choose>
+                    <xsl:when test="$note/@author">
+                        <xsl:value-of select="$note/@author"/>
+                    </xsl:when>
+                    <xsl:when test="$reference">
+                        <xsl:value-of select="$reference/@author"/>                               
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+
+            <xsl:variable name="date">
+                <xsl:choose>
+                    <xsl:when test="$note/@date">
+                        <xsl:value-of select="$note/@date"/>
+                    </xsl:when>
+                    <xsl:when test="$reference">
+                        <xsl:value-of select="$reference/@date"/>                      
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+
+        <span class="note-header">
+            <xsl:choose>
+                <xsl:when test="$author != '' and $date != ''">
+                    [&#160;<xsl:value-of select="$author"/>&#160;<xsl:value-of select="$date"/>&#160;]
+                </xsl:when>
+                <xsl:when test="$author != ''">
+                    [&#160;<xsl:value-of select="$author"/>&#160;]                        
+                </xsl:when>
+                <xsl:when test="$date != ''">
+                    [&#160;<xsl:value-of select="$date"/>&#160;]                        
+                </xsl:when>
+            </xsl:choose>
+        </span>
+
+        <xsl:if test="$reference">
+            <xsl:copy-of select="$reference/node()"/>                
+        </xsl:if>
+        <xsl:copy-of select="$note/node()"/>      
 
+        </div>
+    </xsl:template>
 
 </xsl:stylesheet>

+ 105 - 0
tools/regression/xsl_reports/xsl/exslt/functions/replace/str.replace.function.xsl

@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:str="http://exslt.org/strings"
+                xmlns:func="http://exslt.org/functions"
+                xmlns:exsl="http://exslt.org/common"
+                extension-element-prefixes="str exsl func">
+
+<func:function name="str:replace">
+	<xsl:param name="string" select="''" />
+   <xsl:param name="search" select="/.." />
+   <xsl:param name="replace" select="/.." />
+   <xsl:choose>
+      <xsl:when test="not($string)">
+        <func:result select="/.." />
+      </xsl:when>
+      <xsl:when test="function-available('exsl:node-set')">
+         <!-- this converts the search and replace arguments to node sets
+              if they are one of the other XPath types -->
+         <xsl:variable name="search-nodes-rtf">
+           <xsl:copy-of select="$search" />
+         </xsl:variable>
+         <xsl:variable name="replace-nodes-rtf">
+           <xsl:copy-of select="$replace" />
+         </xsl:variable>
+         <xsl:variable name="replacements-rtf">
+            <xsl:for-each select="exsl:node-set($search-nodes-rtf)/node()">
+               <xsl:variable name="pos" select="position()" />
+               <replace search="{.}">
+                  <xsl:copy-of select="exsl:node-set($replace-nodes-rtf)/node()[$pos]" />
+               </replace>
+            </xsl:for-each>
+         </xsl:variable>
+         <xsl:variable name="sorted-replacements-rtf">
+            <xsl:for-each select="exsl:node-set($replacements-rtf)/replace">
+               <xsl:sort select="string-length(@search)" data-type="number" order="descending" />
+               <xsl:copy-of select="." />
+            </xsl:for-each>
+         </xsl:variable>
+         <xsl:variable name="result">
+           <xsl:choose>
+              <xsl:when test="not($search)">
+                <xsl:value-of select="$string" />
+              </xsl:when>
+             <xsl:otherwise>
+               <xsl:call-template name="str:_replace">
+                  <xsl:with-param name="string" select="$string" />
+                  <xsl:with-param name="replacements" select="exsl:node-set($sorted-replacements-rtf)/replace" />
+               </xsl:call-template>
+             </xsl:otherwise>
+           </xsl:choose>
+         </xsl:variable>
+         <func:result select="exsl:node-set($result)/node()" />
+      </xsl:when>
+      <xsl:otherwise>
+         <xsl:message terminate="yes">
+            ERROR: function implementation of str:replace() relies on exsl:node-set().
+         </xsl:message>
+      </xsl:otherwise>
+   </xsl:choose>
+</func:function>
+
+<xsl:template name="str:_replace">
+  <xsl:param name="string" select="''" />
+  <xsl:param name="replacements" select="/.." />
+  <xsl:choose>
+    <xsl:when test="not($string)" />
+    <xsl:when test="not($replacements)">
+      <xsl:value-of select="$string" />
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="replacement" select="$replacements[1]" />
+      <xsl:variable name="search" select="$replacement/@search" />
+      <xsl:choose>
+        <xsl:when test="not(string($search))">
+          <xsl:value-of select="substring($string, 1, 1)" />
+          <xsl:copy-of select="$replacement/node()" />
+          <xsl:call-template name="str:_replace">
+            <xsl:with-param name="string" select="substring($string, 2)" />
+            <xsl:with-param name="replacements" select="$replacements" />
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="contains($string, $search)">
+          <xsl:call-template name="str:_replace">
+            <xsl:with-param name="string" select="substring-before($string, $search)" />
+            <xsl:with-param name="replacements" select="$replacements[position() > 1]" />
+          </xsl:call-template>      
+          <xsl:copy-of select="$replacement/node()" />
+          <xsl:call-template name="str:_replace">
+            <xsl:with-param name="string" select="substring-after($string, $search)" />
+            <xsl:with-param name="replacements" select="$replacements" />
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="str:_replace">
+            <xsl:with-param name="string" select="$string" />
+            <xsl:with-param name="replacements" select="$replacements[position() > 1]" />
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

+ 4 - 0
tools/regression/xsl_reports/xsl/exslt/functions/replace/str.replace.xsl

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt.org/functions" xmlns:str="http://exslt.org/strings" version="1.0" extension-element-prefixes="str" str:doc="http://www.exslt.org/str">
+   <import href="str.replace.function.xsl"/>
+</stylesheet>

+ 4 - 0
tools/regression/xsl_reports/xsl/exslt/str.xsl

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/Strings" version="1.0" extension-element-prefixes="str" str:doc="http://www.exslt.org/str">
+   <import href="functions/replace/str.replace.xsl"/>
+</stylesheet>

+ 5 - 6
tools/regression/xsl_reports/xsl/html/master.css

@@ -163,19 +163,18 @@ table.summary-table
     text-decoration: underline;
 }
 
-td.toolset-name
+ td.toolset-name
+,td.required-toolset-name
 {
     vertical-align: middle;
-    padding-left: 3pt;  
-    padding-right: 3pt;  
+    padding-left: 3pt;
+    padding-right: 3pt;
+    word-spacing: -3pt;
 }
 
 td.required-toolset-name
 {
     font-weight: bold;
-    vertical-align: middle;
-    padding-left: 3pt;  
-    padding-right: 3pt;  
 }
 
 td.library-corner-case-header

+ 4 - 2
tools/regression/xsl_reports/xsl/issues_page.xsl

@@ -10,12 +10,14 @@
 -->
 
 <xsl:stylesheet 
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:exsl="http://exslt.org/common"
     xmlns:func="http://exslt.org/functions"
-    xmlns:meta="http://www.meta-comm.com"
+    xmlns:str="http://exslt.org/strings"
     xmlns:set="http://exslt.org/sets"
+    xmlns:meta="http://www.meta-comm.com"
     extension-element-prefixes="func exsl"
+    exclude-result-prefixes="set str meta"
     version="1.0">
 
     <xsl:import href="common.xsl"/>

+ 3 - 0
tools/regression/xsl_reports/xsl/links_page.xsl

@@ -13,8 +13,11 @@
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:exsl="http://exslt.org/common"
     xmlns:func="http://exslt.org/functions"
+    xmlns:str="http://exslt.org/strings"
+    xmlns:set="http://exslt.org/sets"
     xmlns:meta="http://www.meta-comm.com"
     extension-element-prefixes="func exsl"
+    exclude-result-prefixes="set str meta"
     version="1.0">
 
     <xsl:import href="common.xsl"/>

+ 3 - 1
tools/regression/xsl_reports/xsl/result_page.xsl

@@ -13,9 +13,11 @@
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:exsl="http://exslt.org/common"
     xmlns:func="http://exslt.org/functions"
+    xmlns:str="http://exslt.org/strings"
     xmlns:set="http://exslt.org/sets"
     xmlns:meta="http://www.meta-comm.com"
     extension-element-prefixes="func exsl"
+    exclude-result-prefixes="set str meta"
     version="1.0">
 
     <xsl:import href="common.xsl"/>
@@ -103,7 +105,7 @@
 
             <xsl:variable name="toolset_notes" select="exsl:node-set( $toolset_notes_fragment )/*"/>
 
-            <td class="{$class}"><xsl:value-of select="$toolset"/>
+            <td class="{$class}"><xsl:value-of select="meta:toolset_name( $toolset )"/>
             <xsl:if test="count( $toolset_notes ) > 0">
                 <span class="super">
                     <xsl:for-each select="$toolset_notes">

+ 3 - 1
tools/regression/xsl_reports/xsl/summary_page.xsl

@@ -13,9 +13,11 @@
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:exsl="http://exslt.org/common"
     xmlns:func="http://exslt.org/functions"
+    xmlns:str="http://exslt.org/strings"
     xmlns:set="http://exslt.org/sets"
     xmlns:meta="http://www.meta-comm.com"
     extension-element-prefixes="func exsl"
+    exclude-result-prefixes="set str meta"
     version="1.0">
 
     <xsl:import href="common.xsl"/>
@@ -353,7 +355,7 @@
             </xsl:choose>
         </xsl:variable>
           
-        <td class="{$class}"><xsl:value-of select="@toolset"/></td>
+        <td class="{$class}"><xsl:value-of select="meta:toolset_name( @toolset )"/></td>
         </xsl:for-each>
 
         <td class="head">toolset / library</td>

粤ICP备19079148号