Improve Formatting of Locales in CTS Report
Bug 2660737
Add a XLT snippet to insert a line break every 10 locales...
Change-Id: I8430ca42e0b936f18735483146a35f89aa5ca18f
diff --git a/tools/host/src/res/cts_result.css b/tools/host/src/res/cts_result.css
index 869c4dd..735fd8b 100644
--- a/tools/host/src/res/cts_result.css
+++ b/tools/host/src/res/cts_result.css
@@ -79,6 +79,7 @@
#summaryinfo td {
padding:1px;
border-width: 0px 0px 0px 0px;
+ vertical-align: top;
}
/* The test summary */
diff --git a/tools/host/src/res/cts_result.xsl b/tools/host/src/res/cts_result.xsl
index 0ff7e93..e097fc8 100644
--- a/tools/host/src/res/cts_result.xsl
+++ b/tools/host/src/res/cts_result.xsl
@@ -102,7 +102,9 @@
<TR>
<TD class="rowtitle">Supported Locales</TD>
<TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@locales"/>
+ <xsl:call-template name="formatDelimitedString">
+ <xsl:with-param name="string" select="TestResult/DeviceInfo/BuildInfo/@locales"/>
+ </xsl:call-template>
</TD>
</TR>
<TR>
@@ -403,10 +405,31 @@
</TABLE>
</xsl:for-each> <!-- end test package -->
</DIV>
+ </body>
+ </html>
+ </xsl:template>
- </body>
- </html>
-</xsl:template>
+ <!-- Take a delimited string and insert line breaks after a some number of elements. -->
+ <xsl:template name="formatDelimitedString">
+ <xsl:param name="string" />
+ <xsl:param name="numTokensPerRow" select="10" />
+ <xsl:param name="tokenIndex" select="1" />
+ <xsl:if test="$string">
+ <!-- Requires the last element to also have a delimiter after it. -->
+ <xsl:variable name="token" select="substring-before($string, ';')" />
+ <xsl:value-of select="$token" />
+ <xsl:text> </xsl:text>
+
+ <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
+ <br />
+ </xsl:if>
+ <xsl:call-template name="formatDelimitedString">
+ <xsl:with-param name="string" select="substring-after($string, ';')" />
+ <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
+ <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
</xsl:stylesheet>