473,516 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the background based on value in xml using xsl

5 New Member
I have a solarr grid tie system. the power data is dumped in xml. using xsl I want to change the color of the field based on the data going positive ( power from the grid ) or negative ( solar is pushing power to the grid )

I have been trying diffferent things and it just doesn't work. What am I missing ?

[html] <table border="3">
<tr bgcolor="#9acd32">
<th bgcolor="#ffff55" aligh="center" colspan="4">Current System Status</th>
<th bgcolor="#cc9966" aligh="center" colspan="4" border="3">Solar Energy System Status</th>
</tr>
<tr bgcolor="#9acd32">
<th bgcolor="#ddea99" align="center">Neg=Solar Pos=REC</th>
<th bgcolor="#ddea99" align="center">Voltage</th>
<th bgcolor="#ddea99" align="center">Amps</th>
<th bgcolor="#ddea99" align="center">Consumption</th>
</tr>
<tr>
<xsl:if test="watts &lt; 0>
<td bgcolor="#00ff00"><xsl:value-of select="xmlpower/record/watts" /></td>
</xsl:if>
<xsl:if test="watts &gt; 0>
<td bgcolor="#ff0000"><xsl:value-of select="xmlpower/record/watts" /></td>
</xsl:if>
<td bgcolor="#ffff00"><xsl:value-of select="xmlpower/record/volts" /></td>
<td bgcolor="#ffff00"><xsl:value-of select="xmlpower/record/amps" /></td>
<td bgcolor="#ffff00"><xsl:value-of select="xmlpower/record/power" /></td>
</tr>
</table>[/html]
Apr 12 '07 #1
3 2454
ml41782
5 New Member
I forgot to mention exactt equal amounts work, just not GT or LT
Apr 12 '07 #2
dorinbogdan
839 Recognized Expert Contributor
Welcome to TheScripts TSDN....

Try this way:
[html]<xsl:if test="number(watts) &lt; 0">[/html]

Don't forget to close the quotation-marks after 0 (they are missing in your sample).
Apr 13 '07 #3
sani723
117 New Member
in my opinion u should define a class and then make a method to change the background color, and then access that method through extention objects and then u can even change the color at run time and can use for large files, without even writing bgcolor='xxxx' properties every time.
Apr 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
61484
by: Udo Marx | last post by:
Hello to ciwas! Is there a way to change the bullet form, color, etc, of the element <li> under<ul> via css? Any reply will be appreciated. -- Freundliche Gruesse, Netzteil - Udo Marx http://www.netzteil.com mailto:marx@netzteil.com
0
1576
by: gogram | last post by:
Hi, I am looking to change a frames based webite (3 rows no columns)(top - Nav, middle - Content, bottom - information) to be a tables based site possibly using css. I hav got the frame setting on the css file ok but having trouble with the configuration for the table setup. The frame setup is: frameset { padding: 0px; border: 0px }...
11
3175
by: Konrad Den Ende | last post by:
I have a function returning a string but the problem is that the color of it is blue which suits me well for some pages but not for others. Is it possible to "feel" what the color of the background in the current document is and set the color of the output accordingly? The background will be an image, in most cases. -- Kindly Konrad
31
5662
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a calendar, 7 across by whatever needed down, and I manually create it each month - not a big deal. Every day I go in and darken the background color of...
7
2783
by: VB Programmer | last post by:
I am trying to change some webform's background color based on a value in my web.config file. This is how I am doing it: ' set background color based on web.config setting Dim Body As New HtmlGenericControl Body = CType(Page.Controls(1), HtmlGenericControl) Body.Attributes("bgcolor") = ConfigurationSettings.AppSettings("BackgroundColor")
1
1105
by: JC | last post by:
Is there a way to change the background color of a specific item in a datagrid based on it's value? For example, assuming I have the following table layout genr son lengt If the genre is 'Rock' then I would like to give the row a different color than if the genre is 'Rap'. It seems like this would be a pretty common desire, but I haven't...
12
4502
by: GaryDean | last post by:
In the original post I failed so indicate that I am using framework 1.1....... I need to be able to change the background color of a page from code. I found an answer to this question in another forum from Peter Huang that said that an id="bg" as follows... <body MS_POSITIONING="GridLayout" runat="server" id="bg"> then we could do...
2
2153
by: Jason_SanDiego2006 | last post by:
Hello all, Hang with me, I'm a little new. I'm working on a web application in C# using ASP.NET 2.0 The goal of my application is to have pages whose styles can be dynamically changed based on the logged-in user's saved preferences. The user can define their own styles (font-size, font-family, color, etc.)
5
5228
by: jeddiki | last post by:
I want to change the default background color of my select box. Here is the problem: Link to form with color select Notice in the color selector, the background color that I have given it it the option statement changes on hover to a blue/gray. Instead of background color change I would like the text to BOLD. So on hovering over green,...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.