473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

if test to colour

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

May 1 '07 #1
1 1427
aidy wrote:
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.
Then add a bgcolor attribute e.g. instead of
<td><xsl:value-of select="."/></td>
use
<td>
<xsl:attribute name="bgcolor">
<xsl:choose>
<xsl:when test=". = 'PASS'">limegreen</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="."/>
</td>
--

Martin Honnen
http://JavaScript.FAQTs.com/
May 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and...
1
by: Wayne | last post by:
I'm interested to know if I am the only person in the world who hates the default Windows XP colour scheme ie. Blue. Whoever was in charge of this in the Windows design team must have been either...
2
by: Carl Gilbert | last post by:
Hi I am looking to edit an icon at runtime on menu items such as change fill colour. I wish to replicate the features found in most applications where by the coloured bar on a colour picker...
11
by: Tim Marshall | last post by:
I use Terry Kreft's & Stephen Lebans colour dialog procedures for users to pick colours for various control properties in certain apps. Is there a way to take the colour code that is displayed in...
10
by: Pulzar | last post by:
Hi there, I want to show a simple image on a web page, and allow the viewer to select and change one of the colours used in the image, and immediately preview the result. I'd like to keep the...
20
by: Chor Lit | last post by:
Hi, I asked Bjarne Stroustrup about the idea of adding colour standard for C++, and he said that it is very difficult for compiler vendors to change their IDE. But do you think it is possible ? ...
0
by: peridian | last post by:
I've gotten a very good serious of regular expressions to go through C code and add span tags around it to colour code the syntax. The one thing I can't figure out is how to stop it from putting...
4
by: Johny | last post by:
I use PIL to write some text to a picture.The text must be seen wery clearly. I write the text to different pictures but to the same position. As pictures maybe different, colour, in the...
6
Robbie
by: Robbie | last post by:
Hi. I've made 2 functions which play around with colours. They convert a 'colour number' (I don't know what the proper name for it is, so I call it this - the Long given back by RGB(),...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.