Using xml, xsl, html, cant change font size

K

kmunderwood

I am having trouble changing the font size when extracting xml into an
html web page.
I think it can be done so many ways, that my searches bring up examples
that I am not familiar with.
I am a newbie at xml and xsl

This is my xml("index.xml")page(I can not change this, it comes to me
this way.

<?xml version="1.0" encoding="iso-8859-1" ?>
- <fieldgate ser="6C000D010A0" tag="TTL Bulk Storage Farm" type="full"
devices="all">
<time>19700101-000000</time>
<timezone>0</timezone>
<ff_version>01.02.02-071 20050118</ff_version>
<os_version>3.18</os_version>
<conf>FXA520-AA1A</conf>
- <device id="11183312ee" tag="B05" type="HART">
<u4>°C</u4>
<v4>22.22</v4>
<u2>In H2O</u2>
<dev>Cerabar S</dev>
<man>Endress+Hauser</man>
<u1>lb</u1>
<v1>535.91</v1>
<type>HART</type>
- <param>
<t1ch>Bulk Tank B5</t1ch>
<t2ch>Weight in Pounds</t2ch>
<max>43928.00</max>
<min>0.00</min>
</param>
</device>
</fieldgate>

The "device" element repeats 11 more times, and I want to ignore some,
so I am using an "if match" technique.
I just repeat the table for each bulk tank that I want to display.

This is my xsl("index.xsl"):

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<table width="800" border="2" bordercolor="#3300CC"
bgcolor="#0099CC">
<tr>
<th>Tank #</th>
<th>Current Level</th>
<th>Temp.</th>
<th>@</th>
</tr>
<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>
<td width="200"><xsl:value-of select="u4"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

This shows an html page like this:
Tank # CurrentLevel Temp. @
B01 395.47 69.65 °F

No matter what I try, the B01, shows the exact same way, or the page
becomes just blank, and shows nothing.


This is my html:

<html>
<body>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("index.xml")

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

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

</body>
</html>

If any one can tell me how to do this, and where to place the code, I
would appreciate it.
I see code examples, but dont know where to place it.
I am working off of an xml, xsl tutorial web site, and have had
success, but can not get over the hump of this font size, and perhaps
page colors, etc.

Any help in the right direction would help, even if I should find
another language to learn.

Thx in advance,
Ken
 
J

Jukka K. Korpela

I am having trouble changing the font size when extracting xml into
an html web page.

I can't see any attempt to change font size in the code you included.
When HTML is your output format, it would appear to be natural to
use a CSS style sheet for such purposes. You could use CSS either by
including a suitable <link> element into the HTML code or by including
a <style> element into the <head> part of the HTML document, e.g.
<style type="text/css">
th, td { font-size: 90%; }
</style>
 
K

kmunderwood

Jukka said:
I can't see any attempt to change font size in the code you included.
When HTML is your output format, it would appear to be natural to
use a CSS style sheet for such purposes. You could use CSS either by
including a suitable <link> element into the HTML code or by including
a <style> element into the <head> part of the HTML document, e.g.
<style type="text/css">
th, td { font-size: 90%; }
</style>


Jukka,
wow, that was simple.
I was not doing something right.

Kiitoksia oikein paljon,
Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top