Author: gnichols
Date: 2011-02-14 16:21:36 +0000 (Mon, 14 Feb 2011)
New Revision: 769
Added:
trunk/test-env/www/cgi/xsl/filter.xsl
trunk/test-env/www/cgi/xsl/run.xsl
trunk/test-env/www/cgi/xsl/summary.xsl
trunk/test-env/www/cgi/xsl/test.xsl
Modified:
trunk/test-env/www/cgi/xsl/default.xsl
Log:
XSLT processing of results.xml prototype
Modified: trunk/test-env/www/cgi/xsl/default.xsl
===================================================================
--- trunk/test-env/www/cgi/xsl/default.xsl 2011-02-04 20:46:58 UTC (rev 768)
+++ trunk/test-env/www/cgi/xsl/default.xsl 2011-02-14 16:21:36 UTC (rev 769)
@@ -9,41 +9,7 @@
</xsl:copy>
</xsl:template>
- <!-- only show device classes if they have planned tests -->
- <xsl:template match="device-class">
- <xsl:if test="count(test) > 0">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:if>
- </xsl:template>
+ <xsl:include href="filter.xsl"></xsl:include>
- <!-- set any <output> elements' name attributes that are not already set
-->
- <xsl:template match="output[not(@name)]">
- <xsl:copy>
- <xsl:apply-templates select="@*"/>
- <xsl:attribute name="name"><xsl:text>Test
Log</xsl:text></xsl:attribute>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
- <!-- just show the name of the attached file, not the actual payload -->
- <xsl:template match="attachment">
- <attachment>attachment: <xsl:value-of
select="@name"/></attachment>
- </xsl:template>
-
- <!-- by default, devices are hidden. "show" shows just the product and
source, full shows all the properties -->
- <xsl:template match="device">
- <xsl:if test="$devices='show'">
- <xsl:copy>
- <xsl:apply-templates select="@*"/>
- </xsl:copy>
- </xsl:if>
- <xsl:if test="$devices='full'">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:if>
- </xsl:template>
</xsl:stylesheet>
Added: trunk/test-env/www/cgi/xsl/filter.xsl
===================================================================
--- trunk/test-env/www/cgi/xsl/filter.xsl (rev 0)
+++ trunk/test-env/www/cgi/xsl/filter.xsl 2011-02-14 16:21:36 UTC (rev 769)
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!-- general filtering of v7 results.xml files
+
+ parameters:
+ devices: hide | show | full
+ device-classes: hide | show | full
+
+ - hides attachment payloads
+
+
+ -->
+
+ <xsl:template match="device-class">
+ <xsl:if test="$device-classes = 'hide'">
+ <xsl:apply-templates select="node()"/>
+ </xsl:if>
+ <xsl:if test="$device-classes = 'show'">
+ <xsl:if test="count(test) > 0">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$device-classes = 'full'">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- hide deleted tests -->
+ <xsl:template match="test">
+ <xsl:if test="not(@status) or (@status != 'deleted')">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- set any <output> elements' name attributes that are not already set
-->
+ <xsl:template match="output[not(@name)]">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="name"><xsl:text>Test
Log</xsl:text></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- just show the name of the attached file, not the actual payload -->
+ <xsl:template match="attachment">
+ <attachment>attachment: <xsl:value-of
select="@name"/></attachment>
+ </xsl:template>
+
+ <!-- by default, devices are hidden. "show" shows just the product and
source, full shows all the properties -->
+ <xsl:template match="device">
+ <xsl:if test="$devices='show'">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ </xsl:copy>
+ </xsl:if>
+ <xsl:if test="$devices='full'">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+
+
+</xsl:stylesheet>
+
+
Added: trunk/test-env/www/cgi/xsl/run.xsl
===================================================================
--- trunk/test-env/www/cgi/xsl/run.xsl (rev 0)
+++ trunk/test-env/www/cgi/xsl/run.xsl 2011-02-14 16:21:36 UTC (rev 769)
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:param name="test"/>
+ <xsl:param name="run" select="'all'"/>
+ <xsl:param name="device"/>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/certification-test/device-class/test">
+ <xsl:if test="not(@status) or (@status != 'deleted')">
+ <xsl:if test="(@name = $test) and (@logical-device = $device)">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="/certification-test/device-class/test/run">
+ <xsl:choose>
+ <xsl:when test="$run = 'all'">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@number = $run">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+ <xsl:include href="filter.xsl"></xsl:include>
+
+</xsl:stylesheet>
+
+
Added: trunk/test-env/www/cgi/xsl/summary.xsl
===================================================================
--- trunk/test-env/www/cgi/xsl/summary.xsl (rev 0)
+++ trunk/test-env/www/cgi/xsl/summary.xsl 2011-02-14 16:21:36 UTC (rev 769)
@@ -0,0 +1,150 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/certification-test">
+ <!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
+ <html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
+ <head>
+ <title>V7 <xsl:value-of select="hardware/vendor"/>
<xsl:value-of select="hardware/model"/></title>
+ <link rel="shortcut icon" href="/v7/images/favicon.ico"
/>
+ <link rel="stylesheet" href="/v7/css/v7.css" />
+ </head>
+
+ <body id="mainone">
+ <div id="wrap">
+ <div id="innerwrap">
+ <!-- HEADER -->
+ <div id="header">
+ <a href="/v7"><img
src="/v7/images/logo_rh_home.png" alt="Red Hat Home"
width="96" height="31" id="rhLogo" /></a>
+ </div><!-- end header -->
+
+ <!-- overview -->
+ <h1>Hardware Certification Test Suite</h1>
+
+ <table class="overview">
+ <thead></thead>
+
+ <tr><td>Vendor:</td><td><xsl:value-of
select="hardware/vendor"/></td></tr>
+ <tr><td>Model:</td><td><xsl:value-of
select="hardware/model"/></td></tr>
+ <tr><td>Arch:</td><td><xsl:value-of
select="hardware/arch"/></td></tr>
+ <tr><td>
+ OS:</td><td><xsl:value-of
select="certification/os/product"/><xsl:text
disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>
+ <xsl:value-of select="certification/os/release"/>
+ (<xsl:value-of select="certification/os/name"/>)
+ </td></tr>
+
+ <tr><td>V7:</td><td><xsl:value-of
select="@v7-version"/> release <xsl:value-of
select="@v7-release" /></td></tr>
+ <tr><td>Date:</td><td><xsl:value-of
select="@plan-time" /></td></tr>
+ </table>
+
+
+ <table class="navigation">
+ <tr><td>See Also:</td>
+ <td><a href="v7xml.py?sheet=summary">test
summary</a></td>
+
+ <td><a href="v7xml.py?sheet=device">device
details</a></td>
+ </tr>
+ </table>
+
+
+ <h2>Test Results:</h2>
+ <table class="results" cellpadding="0"
cellspacing="0" border="0">
+ <thead>
+ <tr>
+ <th colspan="2"
align="right">Run:</th>
+ <xsl:call-template name="runTableHeader">
+ <xsl:with-param name="currentRun" select="1"/>
+ <xsl:with-param name="runs"
select="@number-of-runs"/>
+ </xsl:call-template>
+ </tr>
+ </thead>
+ <xsl:for-each
select="/certification-test/device-class/test">
+ <xsl:if test="not(@status) or (@status !=
'deleted')">
+ <xsl:variable name="currentTest"
select="." />
+ <tr>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+
<xsl:text>v7xml.py?sheet=run&test=</xsl:text><xsl:value-of
select="@name"/>
+ <xsl:if test="@logical-device !=
''">
+
<xsl:text>&device=</xsl:text><xsl:value-of
select="$currentTest/@logical-device"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </a>
+ </td>
+ <td><xsl:text
disable-output-escaping="yes"><![CDATA[ ]]></xsl:text><xsl:value-of
select="@logical-device"/></td>
+
+ <xsl:call-template name="runTableRow">
+ <xsl:with-param name="currentRunNumber"
select="1"/>
+ <xsl:with-param name="runs"
select="/certification-test/@number-of-runs"/>
+ <xsl:with-param name="currentTest"
select="$currentTest"/>
+ <xsl:with-param name="currentRun"
select="$currentTest/run"/>
+ </xsl:call-template>
+
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </table>
+
+ </div>
+ </div>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template name="runTableHeader">
+ <xsl:param name="currentRun"/>
+ <xsl:param name="runs"/>
+ <xsl:if test="$currentRun <= $runs">
+ <th><xsl:value-of select="$currentRun"/></th>
+ <xsl:call-template name="runTableHeader">
+ <xsl:with-param name="currentRun" select="$currentRun +
1"/>
+ <xsl:with-param name="runs" select="$runs"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="runTableRow">
+ <xsl:param name="currentRunNumber"/>
+ <xsl:param name="runs"/>
+ <xsl:param name="currentTest"/>
+ <xsl:param name="currentRun"/>
+ <xsl:if test="$currentRunNumber <= $runs">
+ <xsl:choose>
+ <xsl:when test="number($currentRun/@number) =
number($currentRunNumber)">
+ <td>
+ <a>
+ <xsl:attribute name="href">
+
<xsl:text>v7xml.py?sheet=run&test=</xsl:text><xsl:value-of
select="$currentTest/@name"/>
+ <xsl:text>&run=</xsl:text><xsl:value-of
select="$currentRun/@number"/>
+ <xsl:if test="$currentTest/@logical-device != ''">
+ <xsl:text>&device=</xsl:text><xsl:value-of
select="$currentTest/@logical-device"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:value-of select="$currentRun/summary" />
+ </a>
+ </td>
+ <xsl:call-template name="runTableRow">
+ <xsl:with-param name="currentRunNumber"
select="$currentRunNumber + 1"/>
+ <xsl:with-param name="runs" select="$runs"/>
+ <xsl:with-param name="currentTest"
select="$currentTest"/>
+ <xsl:with-param name="currentRun"
select="$currentRun/following::run"/>
+ </xsl:call-template>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <td><xsl:text
disable-output-escaping="yes"><![CDATA[ ]]></xsl:text></td>
+ <xsl:call-template name="runTableRow">
+ <xsl:with-param name="currentRunNumber"
select="$currentRunNumber + 1"/>
+ <xsl:with-param name="runs" select="$runs"/>
+ <xsl:with-param name="currentTest"
select="$currentTest"/>
+ <xsl:with-param name="currentRun"
select="$currentRun"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+
\ No newline at end of file
Added: trunk/test-env/www/cgi/xsl/test.xsl
===================================================================
--- trunk/test-env/www/cgi/xsl/test.xsl (rev 0)
+++ trunk/test-env/www/cgi/xsl/test.xsl 2011-02-14 16:21:36 UTC (rev 769)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/certification-test/device-class/test">
+ <xsl:if test="@name = $test">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="/certification-test/device-class/test/run">
+ <xsl:if test="@number = $run">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:include href="filter.xsl"></xsl:include>
+
+</xsl:stylesheet>
+
+