K
kmunderwood
I have an xml file that I get "As Is"
(at bottom of post)
I want to sort and exclude some elements, and
turn other child elements red, or its background.
I want it to look like this:
Tank Level Temperature
B05 535.91 22.22
I want 535.91 to turn red when under, let say 600
(Or its background)
I have tried techniques likeAbbreviated)
<XML ID="data" SRC="c:\xml\index.xml"></XML>
<TABLE id="device" datasrc="#data" datafld="device">
<tr><td><span id="device" datafld="tag"></span></td></tr></TABLE>
This gives me all elements with the "tag" field
I want to ignore some "Tag"s
I have tried xsl, like this: (xsl:if match)
<xsl:for-each select="fieldgate/device">
<xsl:if match=".[tag='B01']">
<tr>
<td width="200"><xsl:value-of select="tag"/></td>
<td width="200"><xsl:value-of select="v1"/></td>
<td width="200"><xsl:value-of select="v4"/></td>
This gives me almost exactly what I want, except the "v1"(level)
turning red when under 600. This is easy, because I can just repeat the
table and change the "if match" to match the tank#
I tried other xsl, "for-each", xsl:choose, xsl:when test, like:
<xsl:for-each select="fieldgate/device">
<tr>
<td><xsl:value-of select="tag"/></td>
<xsl:choose>
<xsl:when test="v1 < 600">
<td bgcolor="#ff00ff">
<xsl:value-of select="v1"/></td>
</xsl:when>
<xsltherwise>
<td><xsl:value-of select="v1"/></td>
</xsltherwise>
</xsl:choose>
<td><xsl:value-of select="v4"/></td>
</tr>
</xsl:for-each>
This works great, except it returns all of the "tags"
and does not sort, and looks like this:
(535.91 background cell is red,...and -0.01)
Tank Level Temperature
B05 535.91 22.22
B04 42567.36 22.81
B06 37265.17 21.94
_4..20mA-1 -0.01 blank
So, I have displayed it with ,<span>, "if match" and the
combo xsl:choose", "when test", xsltherwise, etc.
All do a nice job, but I need better control.
I am a newbie, but I am willing to learn, but not what seems like 10
different languages to build a simple web page from an xml document.
If someone can tell me a method that give me this control, I will go in
that direction.
I dont really need to become en expert, I need to make a web page and
move on to other projects.
I also need to use css or other means to affect the font size.
Any help will be greatly appreciated
The xml looks like this:
<?xml version="1.0" encoding="iso-8859-1" ?>
<fieldgate ser="6C000D010A0" tag="TTL Bulk Storage Farm" type="full"
devices="all">
<timezone>0</timezone>
<os_version>3.18</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+Hauser</man>
<u1>lb</u1>
<v1>535.91</v1>
<type>HART</type>
<unid>11183312ee</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+Hauser</man>
<unid>_4..20mA-2</unid>
</device>
</fieldgate>
Thank you,,,,Ken
(at bottom of post)
I want to sort and exclude some elements, and
turn other child elements red, or its background.
I want it to look like this:
Tank Level Temperature
B05 535.91 22.22
I want 535.91 to turn red when under, let say 600
(Or its background)
I have tried techniques likeAbbreviated)
<XML ID="data" SRC="c:\xml\index.xml"></XML>
<TABLE id="device" datasrc="#data" datafld="device">
<tr><td><span id="device" datafld="tag"></span></td></tr></TABLE>
This gives me all elements with the "tag" field
I want to ignore some "Tag"s
I have tried xsl, like this: (xsl:if match)
<xsl:for-each select="fieldgate/device">
<xsl:if match=".[tag='B01']">
<tr>
<td width="200"><xsl:value-of select="tag"/></td>
<td width="200"><xsl:value-of select="v1"/></td>
<td width="200"><xsl:value-of select="v4"/></td>
This gives me almost exactly what I want, except the "v1"(level)
turning red when under 600. This is easy, because I can just repeat the
table and change the "if match" to match the tank#
I tried other xsl, "for-each", xsl:choose, xsl:when test, like:
<xsl:for-each select="fieldgate/device">
<tr>
<td><xsl:value-of select="tag"/></td>
<xsl:choose>
<xsl:when test="v1 < 600">
<td bgcolor="#ff00ff">
<xsl:value-of select="v1"/></td>
</xsl:when>
<xsltherwise>
<td><xsl:value-of select="v1"/></td>
</xsltherwise>
</xsl:choose>
<td><xsl:value-of select="v4"/></td>
</tr>
</xsl:for-each>
This works great, except it returns all of the "tags"
and does not sort, and looks like this:
(535.91 background cell is red,...and -0.01)
Tank Level Temperature
B05 535.91 22.22
B04 42567.36 22.81
B06 37265.17 21.94
_4..20mA-1 -0.01 blank
So, I have displayed it with ,<span>, "if match" and the
combo xsl:choose", "when test", xsltherwise, etc.
All do a nice job, but I need better control.
I am a newbie, but I am willing to learn, but not what seems like 10
different languages to build a simple web page from an xml document.
If someone can tell me a method that give me this control, I will go in
that direction.
I dont really need to become en expert, I need to make a web page and
move on to other projects.
I also need to use css or other means to affect the font size.
Any help will be greatly appreciated
The xml looks like this:
<?xml version="1.0" encoding="iso-8859-1" ?>
<fieldgate ser="6C000D010A0" tag="TTL Bulk Storage Farm" type="full"
devices="all">
<timezone>0</timezone>
<os_version>3.18</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+Hauser</man>
<u1>lb</u1>
<v1>535.91</v1>
<type>HART</type>
<unid>11183312ee</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+Hauser</man>
<unid>_4..20mA-2</unid>
</device>
</fieldgate>
Thank you,,,,Ken