473,671 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I show only one Element with this code


How do I show only one Element with this code
Help Me, OH!!! Help Me ;)

I have code that works, but...

This is the way it comes out in html
The Level, or Element "v1"(background ) turns red when under 600

Bulk Storage Tanks

Tank<tag> Level<v1> Temperature<v4>
B05 535.91 22.22
B04 42567.36 22.81
B06 37265.17 21.94
B11 86.47 22.67
B01 395.47 69.65
B10 2.29 21.66
B07 32974.62 23.12
B03 13007.45 22.18
B02 23328.18 22.53
B12 71.17 21.57
B09 28961.24 22.34
B08 28045.13 21.52
P&F HM NAN none
_4..20mA-1 -0.01 none
_4..20mA-2 -0.01 none
_5V 4.92 none none
_boardtemp none 45.41

But, This is the way I want it

Tank Level Temperature
B01 395.47 69.65
(red bground)

Then, I can repeat the code in its own table, to show only the tanks
that I need.
(And in the order I want also)

Here is the abbreviated xml (I dont make the xml)
Full xml: http://home.earthlink.net/~kmunderwood/index.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<fieldgate ser="1B555D010A 0" tag="TTL Bulk Storage Farm" type="full"
devices="all">
<os_version>3.1 8</os_version>
<conf>FXA520-AA1A</conf>
<device id="11183312ee " tag="B05" type="HART">
<v4>22.22</v4>
<tag>B05</tag>
<u1>lb</u1>
<v1>535.91</v1>
</device>
<device id="11183312e6 " tag="B04" type="HART">
<v4>22.81</v4>
<tag>B04</tag>
<u1>lb</u1>
<v1>42567.36</v1>
</device>
<device id="11183309c5 " tag="B01" type="HART">
<v4>69.65</v4>
<tag>B01</tag>
<u1>lb</u1>
<v1>395.47</v1>
</device>
<device id="_boardtemp " tag="_boardtemp " type="INTRN">
<tag>_boardtemp </tag>
<v1>45.41</v1>
<man>Endress+Ha user</man>
</device>
</fieldgate>

Here 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="green" >
<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="red">
<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>

How do I tell it to show only B01, or B02, etc, plus its child Elements
that I choose?

Someone???An example??? Explainations might go over my head, but if
that is all you can give, Ill take it.

Thank you, Thank You, Thank You.

Ken

Jul 20 '05 #1
2 1307


km*********@cha rter.net wrote:
How do I show only one Element with this code Tank Level Temperature
B01 395.47 69.65
(red bground)
Here is the abbreviated xml (I dont make the xml)
Full xml: http://home.earthlink.net/~kmunderwood/index.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<fieldgate ser="1B555D010A 0" tag="TTL Bulk Storage Farm" type="full"
devices="all"> <device id="11183309c5 " tag="B01" type="HART">
<v4>69.65</v4>
<tag>B01</tag>
<u1>lb</u1>
<v1>395.47</v1>
You could define a global parameter in your stylesheet for that tag
value you are looking for e.g. <?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:param name="deviceTag " />
or if you want to have a default value
<xsl:param name="deviceTag " select="'B01'" />
<xsl:template
match="/">
<html>
<body>
<h2>Bulk Storage Tanks</h2>
<table border="1">
<tr bgcolor="green" >
<th>Tank</th>
<th>Level</th>
<th>Temperature </th>
</tr>
<xsl:for-each select="fieldga te/device">


Then here you would need
<xsl:for-each select="fieldga te/device[@tag = $deviceTag]">

Then check the documentation of your XSLT processor on how to set global
parameters when you run a transformation.

Of course depending on what you want to achieve and how your input data
looks you might not even need a xsl:for-each loop but I have tried to
suggest a small change to your posted XSL instead of creating a new one.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Oh wow, that is great..Thank You
I have repeated the param name, and made a table for each
tank, to give me exactly what I am looking for.
Cant thank you enough.
!!!!!!!
Ken

How to I check to see which XSLT processor I am running?
I will look it up to continue my lesson.

This is what it looks like now.

<?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="/">
<xsl:param name="deviceTag 1" select="'B01'" />
<xsl:param name="deviceTag 2" select="'B02'" />
<xsl:param name="deviceTag 3" select="'B03'" />
<xsl:param name="deviceTag 4" select="'B04'" />
<xsl:param name="deviceTag 5" select="'B05'" />
<xsl:param name="deviceTag 6" select="'B06'" />
<xsl:param name="deviceTag 7" select="'B07'" />
<xsl:param name="deviceTag 8" select="'B08'" />
<xsl:param name="deviceTag 9" select="'B09'" />
<xsl:param name="deviceTag 10" select="'B10'" />
<xsl:param name="deviceTag 11" select="'B11'" />
<xsl:param name="deviceTag 12" select="'B12'" />
<html>
<body>
<h2>Bulk Storage Tanks</h2>
<table border="1">
<tr bgcolor="green" >
<th>Tank</th>
<th>Level</th>
<th>Temperature </th>
</tr>

<xsl:for-each select="fieldga te/device[@tag = $deviceTag1]">
<tr>
<td><xsl:valu e-of select="@tag"/></td>
<xsl:choose>
<xsl:when test="v1 &lt; 600">
<td bgcolor="red">
<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>
Repeated to the end.
</body>
</html>
</xsl:template></xsl:stylesheet>

Thanks a million!!!!
Ken
Martin Honnen wrote:
km*********@cha rter.net wrote:
How do I show only one Element with this code
Tank Level Temperature
B01 395.47 69.65
(red bground)


Here is the abbreviated xml (I dont make the xml)
Full xml: http://home.earthlink.net/~kmunderwood/index.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<fieldgate ser="1B555D010A 0" tag="TTL Bulk Storage Farm" type="full" devices="all">

<device id="11183309c5 " tag="B01" type="HART">
<v4>69.65</v4>
<tag>B01</tag>
<u1>lb</u1>
<v1>395.47</v1>


You could define a global parameter in your stylesheet for that tag
value you are looking for e.g.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">


<xsl:param name="deviceTag " />
or if you want to have a default value
<xsl:param name="deviceTag " select="'B01'" />
> <xsl:template
match="/">
<html>
<body>
<h2>Bulk Storage Tanks</h2>
<table border="1">
<tr bgcolor="green" >
<th>Tank</th>
<th>Level</th>
<th>Temperature </th>
</tr>
<xsl:for-each select="fieldga te/device">


Then here you would need
<xsl:for-each select="fieldga te/device[@tag = $deviceTag]">

Then check the documentation of your XSLT processor on how to set

global parameters when you run a transformation.

Of course depending on what you want to achieve and how your input data looks you might not even need a xsl:for-each loop but I have tried to suggest a small change to your posted XSL instead of creating a new one.
--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 20 '05 #3

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

Similar topics

3
14433
by: Ryh | last post by:
I have the following scritpt. It hides div layer when mouse is out of the div layer. Inside DIV I have IFRAME box. Unfortuantely it does not work in Mozilla or IE 5.5. It hides div when cursor is inside IFRAME. NOte that IFRAME is inside DIV so it should not hide DIV. It Works fine in IE6.0. Could any one help? Example:
5
35558
by: Mel | last post by:
i need to have 2 side by side iframes, a link on top of the one will show/hide the other can someone help me pleeeeezzzzz ?
3
2945
by: alex | last post by:
I'd like to have a show/hide widget on my web site, kind of like "show details" / "hide details" in Google Groups. Is there a tutorial explaining how to make them? Google's is a bit complex and it's easy to get something wrong. If the browser does not support the required features, I want it to generate a completely static page with the "details" shown automatically.
2
2571
by: Greg | last post by:
Hello, I am trying to display order ids and order details (order items). I would like to give the user Hide/Show option to either display or hide order details. The page would look like: Expand All Collapse All
5
4567
by: srampally | last post by:
I need the capabilty to hide/show a selection list, just the way its done at http://www.lufthansa.com (place the cursor over "Group Companies"). However, I am looking for a javascript that is much simpler. Here is what I have until now. Problems with my code: 1. The selection list becomes invisible when I try to select an option (in Firefox). 2. The selection list stays visible when I just place the cursor over selection list and move...
17
8092
by: alxasa | last post by:
Hi, can someone please show me how to most elegently do this?..... I have a textbox, and I want to search the contents of it and replace all instances of a certain word, and replace that word with something else. For the purposes of this it could be replacing "green" with "blue". Can someone please show me how to properly do this? :) Sincerest regards, Alxasa.
6
4188
by: Norman | last post by:
Hello, I have a working Show / Hide form, that works on FF, but what I would like to do is to be able to display one part when a user clicks on one radio button and display another part when the user clicks on the second radio button - here is the code which just shows / hides the whole form: <script type="text/javascript"> <!-- var dl_elements = new Array('dl_address_country',
11
3719
by: dmorand | last post by:
I'm having some trouble with my javascript which is supposed to hide/show a div element. I have to click on the link twice before it'll hide. I can't seem to figure out why the first click does nothing. function hideshow(which){ if (!document.getElementById) return if (which.style.display=="block") which.style.display="none" else which.style.display="block"
8
2319
by: tkjensen | last post by:
How to make a own dataview in c#? Can someone please help me? I want to get id and users and everything else from database to be showed in the same place at the same time just as DataView. Please help me. Need help for this. I can't find anything that I can use on google. I have searched for Howto make a dataset in c# but I'm new to programming. So please help me. =)
0
8821
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8599
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
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
7439
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...
1
6230
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5696
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4225
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2813
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
1810
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.