Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


if test to colour

From: aidy <aidy.rutter@-----.--->
To: NULL
Date: 5/1/2007 5:55:00 AM
Hi

I have some xml that is similar to this

<testresults>
	<test id="test_1">
		<description>demo test method 1</description>
		<teststatus>PASS</teststatus>
	</test>
	<test id="test_2">
		<description>demo test method 2</description>
		<teststatus>FAIL!</teststatus>
		<failmessage>the remember me checkbox should be set and is not</
failmessage>
	</test>
</testresults>

this is the xslt

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="testresults">
    <table border="2">
      <tr>
        <td><b>TESTID</b></td>
	<td><b>TEST DESCRIPTION</b></td>
        <td><b>STATUS</b></td>
        <td><b>FAILURE MESSAGE</b></td>
      </tr>
      <xsl:apply-templates />
    </table>
  </xsl:template>
  <xsl:template match="test">
    <xsl:for-each select="teststatus">
      <tr>
        <td>
          <xsl:if test="position()=1">
            <xsl:value-of select="../@id"/>
          </xsl:if>
	 </td>
	<td><xsl:value-of select="../description"/></td>
        <td><xsl:value-of select="."/></td>
        <td><xsl:value-of select="following-sibling::failmessage[1]"/
></td>
      </tr>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>


the one thing I am stuck on is if I have a test status of 'PASS' I
would like to colour the cell limegreen and if a 'FAIL' red.

cheers

aidy



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent