Using xml, xsl, html, cant change font size

Discussion in 'XML' started by kmunderwood@charter.net, Mar 9, 2005.

  1. Guest

    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
     
    , Mar 9, 2005
    #1
    1. Advertising

  2. wrote:

    > 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>

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 9, 2005
    #2
    1. Advertising

  3. Guest

    Jukka K. Korpela wrote:
    > wrote:
    >
    > > 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>
    >
    > --
    > Yucca, http://www.cs.tut.fi/~jkorpela/



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

    Kiitoksia oikein paljon,
    Ken
     
    , Mar 10, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dave richards
    Replies:
    2
    Views:
    619
    Paul Furman
    Feb 19, 2004
  2. Wongod
    Replies:
    2
    Views:
    718
  3. Nagaraj
    Replies:
    1
    Views:
    883
    Lionel B
    Mar 1, 2007
  4. wial
    Replies:
    2
    Views:
    830
  5. mttc
    Replies:
    2
    Views:
    2,415
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page