473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble excluding select xml out to HTML using xsl

I am having trouble excluding select xml out to HTML using xsl

I want to ignore some xml and turn others red

I can not find the right way to both:

1. Only show the <tag> that want to, and
2. Turn an attribute a color when it falls below a certain level.
This is the way I want the html to display:

Tank Level Temperature
B05 535.91 22.22

But, the way it pulls in all "Tag"
It looks like:

Tank Level Temperature
B05 535.91 22.22
_4..20mA-2 -0.01 <no data>

I want to ignore the _4..20mA-2, among others.
When the tank level falls below 600, I want the background or text to
turn red.

This is the way I get the xml.
(its abreviated. It is very long and shows 17 "Tag", or devices, but I
only
want to show 12 of them)

<?xml version="1.0" encoding="iso-8859-1" ?>
<fieldgate ser="6C000D010A 0" tag="TTL Bulk Storage Farm" type="full"
devices="all">
<timezone>0</timezone>
<os_version>3.1 8</os_version>
<conf>FXA520-AA1A</conf>
<device id="11183312ee " tag="B05" type="HART">
<u4>°C</u4>
<v4>22.22</v4>
<dev>Cerabar S</dev>
<man>Endress+Ha user</man>
<u1>lb</u1>
<v1>535.91</v1>
<type>HART</type>
<unid>11183312e e</unid>
</device>
<device id="_4..20mA-2" tag="_4..20mA-2" type="INTRN">
<u>mA</u>
<tag>_4..20mA-2</tag>
<hlsts1>OK</hlsts1>
<v1>-0.01</v1>
<man>Endress+Ha user</man>
<unid>_4..20m A-2</unid>
</device>
</fieldgate>


This is the xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"><xsl :template
match="/">
<html>
<body>
<h2>Bulk Storage Tanks</h2>
<table border="1">
<tr bgcolor="#9acd3 2">
<th>Tank</th>
<th>Level</th>
<th>Temperature </th>
</tr>
<xsl:for-each select="fieldga te/device">
<tr>
<td><xsl:valu e-of select="tag"/></td>
<xsl:choose>
<xsl:when test="v1 &lt; 600">
<td bgcolor="#ff00f f">
<xsl:value-of select="v1"/></td>
</xsl:when>
<xsl:otherwis e>
<td><xsl:valu e-of select="v1"/></td>
</xsl:otherwise>
</xsl:choose>
<td><xsl:valu e-of select="v4"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>

This works fine, but includes all "tag", and I want to ignore some.
Tank Level Temperature
B05 535.91 22.22
B04 42567.36 22.81
_4..20mA-2 -0.01 Blank
The 535.91 background turns red, which is what I am looking for, but I
want to ignore <tag> _4..20mA-2

I had success displaying only the ones I wanted, using an "if match".
<xsl:if match=".[tag='B05']">, but I cant "test" on it.
This is the HTML:

<html>

<head>
<style type="text/css">
th, td { font-size: 200%; }
</style>
</head>

<body>

<script language="javas cript">
// Load XML
var xml = new ActiveXObject(" Microsoft.XMLDO M")
xml.async = false
xml.load("index .xml")

// Load the XSL
var xsl = new ActiveXObject(" Microsoft.XMLDO M")
xsl.async = false
xsl.load("index .xsl")

// Transform
document.write( xml.transformNo de(xsl))
</script>

</body>
</html>

Can anyone give me an idea on how to do this, I am stuck, and a newbie
at xml/xsl

Thank You, Ken

Jul 20 '05 #1
0 1395

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

Similar topics

4
1543
by: Mark Rae | last post by:
Hi, Am currently in the process of migrating a whole heap of v1.1 ASP.NET solutions to v2.0, and would be interested to know what others are doing about excluding files from projects. I maintain several music websites which contain lots of static binaries (newsletters, gig photos etc) which, once they are posted, never change. In v1.1, I was able to exclude these files from the project so that they
6
1724
by: Just Me | last post by:
Any ideas on this. I am trying to loop through an xml document to remove attributes, but Im having so much trouble, any help is appreciated //THIS IS THE EXCEPTION ( SEE CODE LINE WHERE FAILURE OCCURS '//Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 13, position 11. //THE XHTML TEXT WHICH IS BEING LOOOKED AT
5
13379
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
1
3141
by: giovannino | last post by:
Dear all, I did a query which update a sequence number (column NR_SEQUENZA) in a table using a nice code (from Trevor !). 1) Given that I'm not a programmer I can't understand why numbering doesn't start always, running more times the update query, from the same starting parameter assigned (1000000000). It seems to me that it takes memory last number calculated and running prox update it starts from last table row updated. I need...
0
9619
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.