Helpful Information
Category: Programming Languages More
XML and Netscape 6


I am trying to do some XML development using Netscape 6.01 A for
Solaris 7 as the browser. Basically, its not working. The XML page
is simple, so I am not using a DTD, just a style sheet to display the page.

I have tried several different xml pages and get the same result.
Below is an example I used that is straight from the devshed
example list:

<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="example_stylesheet.xsl"?>

<name>John Doe</name>
<address>94, Main Street, Nowheresville 16463, XY</address>
<tel>738 2838</tel>

and here is the example_stylesheet.xsl:
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:template match="/">

<h1>Contact information for <b><xsl:value-of select="me/name" /></b></h1>

<h2>Mailing address:</h2> <xsl:value-of select="me/address" />

<h2>Phone:</h2> <xsl:value-of select="me/tel" />

<h2>Email address:</h2> <xsl:value-of select="me/email" />

<h2>Web site URL:</h2> <xsl:value-of select="me/url" />


When I load the example.xml page in netscape, I get the following
John Doe 94, Main Street, Nowheresville 16463, XY 738 2838

All on one line. Basically what it did is extract all of the data and print it.
It doesnt matter if I put the reference to the stylesheet or not, I get the same

From reading the Netscape 6 description, its supposed to be able to
handle XML. Is there some sort of special configuration option, or is
Netscape 6 just as bad the older versions??


After playing around a bit, using an example from that worked correctly, I found that when adding HTML you need the following tag:

<xsl:output method="html" />

A working stylesheet (Netscape 6.2 & Internet Explorer 6) follows:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:strip-space elements="foo"/>

<!-- FileName: MATCH01 -->
<!-- Document: -->
<!-- DocVersion: 19991116 -->
<!-- Section: 2.5 -->
<!-- Creator: David Marston -->
<!-- Purpose: Test for //name match pattern. -->
<!-- set the output properties -->
<xsl:output method="html" />

<xsl:template match="doc">

<xsl:template match="foo/bar//baz">
<FONT COLOR="blue"><xsl:value-of select="@att1"/></FONT>


The corresponding xml is: <?xml version="1.0"?>
<?xml-stylesheet href="select.xsl" type="text/xsl"?>
<foo att1="c">
<bar att1="b">
<foo att1="a">
<baz att1="right"/>
<foo att1="a">
<baz att1="wrong"/>

by the way the Smilie is not supposed to be there it is supposed to be : (colon) immediatly followed by "o" but I didn't turn smilies off ;)

Well I there is another problem ... the transformation works fine if it the files are loaded from the filesystem. When I load them from the Apache webserver only the xml text displays (as described above).

<?xml:stylesheet type="text/xsl" href="example_stylesheet.xsl"?>

is invalid in XSLT but it's valid in XSL. That's why it works in IE but not Mozilla/NS.

Try this syntax instead and it will fix your problem:

<?xml-stylesheet type="text/xsl" href="example_stylesheet.xsl"?>