Problem converting XML to HTML using XSLT on Netscape 7.0

N

nanookfan

Hi all,

I'm having a bizarre problem converting XML files to HTML using an
XSLT. The problem is only occuring in my Netscape 7.0 browser. What
makes it more bizarre is that it is only happening when I put my XML
files and the .xsl files on my ISP's system for my home page. If I
try to open the XML files in Netscape 7.0 on my own machine (ie, not
on the ISP's system), the pages convert file and the result is
displayed in HTML.

Under IE 6.0 there is no problem, both when the files are on the ISP's
system or on my own machine.

When I try to view the files from my ISP's system under Netscape 7.0,
all I see is the XML code. There is no error message or anything like
that, just the XML code.

Something else that is bizarre...I went out to www.w3schools.com and
was working through one of their tutorials on XSLT. I took a look at
one of their examples converted XML to HTML by applying an XSLT. When
I tried their example on their system using Netscape 7.0, it worked
fine. However, when I took THEIR files and loaded them on my ISP's
system and tried to view them using Netscape 7.0, again all I got to
see was the XML code. Again, under IE 6.0 it worked fine in all
cases.

Below is one of the XML files:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="transcript.xsl"?>
<transcript>
<school>
<name>University of Massachusetts - Lowell</name>
<city>Lowell</city>
<state abbreviation="MA">Massachusetts</state>
<websiteurl>http://www.uml.edu/dce</websiteurl>
<degree_program>None - Continuing Education Courses
only</degree_program>
</school>
<courses>
<course>
<coursenumber>92.268</coursenumber>
<coursename>C++ Programming</coursename>
<semester>Spring</semester>
<year>1993</year>
<grade>A/B</grade>
<credits>3.0</credits>
<qualitypoints>3.5</qualitypoints>
</course>
<course>
<coursenumber>92.270</coursenumber>
<coursename>Visual C++ Programming</coursename>
<semester>Spring</semester>
<year>1998</year>
<grade>A</grade>
<credits>3.0</credits>
<qualitypoints>4.0</qualitypoints>
</course>
<course>
<coursenumber>90.301</coursenumber>
<coursename>Java Programming</coursename>
<semester>Spring</semester>
<year>1999</year>
<grade>A</grade>
<credits>3.0</credits>
<qualitypoints>4.0</qualitypoints>
</course>
<course>
<coursenumber>91.373</coursenumber>
<coursename>Dynamic HTML</coursename>
<semester>Spring</semester>
<year>1999</year>
<grade>A/B</grade>
<credits>3.0</credits>
<qualitypoints>3.5</qualitypoints>
</course>
<course>
<coursenumber>92.269</coursenumber>
<coursename>Advanced C++ Programming</coursename>
<semester>Summer</semester>
<year>1999</year>
<grade>A</grade>
<credits>3.0</credits>
<qualitypoints>4.0</qualitypoints>
</course>
<course>
<coursenumber>90.303</coursenumber>
<coursename>Advanced Java</coursename>
<semester>Summer</semester>
<year>2001</year>
<grade>A</grade>
<credits>3.0</credits>
<qualitypoints>4.0</qualitypoints>
</course>
<course>
<coursenumber>90.307</coursenumber>
<coursename>Advanced Topics in Java and XML</coursename>
<semester>Summer</semester>
<year>2002</year>
<grade>A</grade>
<credits>3.0</credits>
<qualitypoints>4.0</qualitypoints>
</course>
</courses>
<totals>
<gradepointaverage maximum="4.0">3.857</gradepointaverage>
<credits>21</credits>
</totals>
<notes>
<note>These courses were taken through the Universitys
Department of Continuing Education, and are not part of a degree or
certificate program.</note>
<note>It is worth noting that these courses were not paid for by
an employer, but out of my pocket, because I believe it is my
responsibility to keep my skills as modern as possible.</note>
</notes>
</transcript>

And here is the XSLT that is supposed to convert this into HTML:

<?xml version="1.0"?>
<xsl:stylesheet id="transcript"
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:eek:utput method="html"/>

<xsl:template match="/">
<xsl:element name="html">
<xsl:element name="body">
<xsl:apply-templates select="transcript/school"/>
<xsl:element name="table">
<xsl:attribute
name="width"><xsl:text>100%</xsl:text></xsl:attribute>
<xsl:apply-templates select="transcript/courses"/>
<xsl:apply-templates select="transcript/totals"/>
</xsl:element>
<xsl:apply-templates select="transcript/notes"/>
</xsl:element>
</xsl:element>
</xsl:template>

<xsl:template match="school">
<xsl:element name="title">
<xsl:value-of select="./name"/><xsl:text>
Transcripts</xsl:text>
</xsl:element>
<xsl:element name="h2">
<xsl:attribute
name="align"><xsl:text>center</xsl:text></xsl:attribute>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of
select="./websiteurl"/></xsl:attribute>
<xsl:value-of select="./name"/>
</xsl:element>
</xsl:element>
<xsl:element name="h3">
<xsl:attribute
name="align"><xsl:text>center</xsl:text></xsl:attribute>
<xsl:value-of select="./city"/><xsl:text>,
</xsl:text><xsl:value-of select="./state/@abbreviation"/>
<xsl:element name="br"/>
</xsl:element>
<xsl:element name="h4">
<xsl:attribute
name="align"><xsl:text>center</xsl:text></xsl:attribute>
<xsl:element name="u"><xsl:text>DEGREE
PROGRAM:</xsl:text></xsl:element>
<xsl:text> </xsl:text><xsl:value-of
select="./degree_program"/>
</xsl:element>
</xsl:template>

<xsl:template match="courses">
<xsl:element name="tr">
<xsl:element name="th">Course Number</xsl:element>
<xsl:element name="th">Course Name</xsl:element>
<xsl:element name="th">Semester</xsl:element>
<xsl:element name="th">Year</xsl:element>
<xsl:element name="th">Grade</xsl:element>
<xsl:element name="th">Credits</xsl:element>
<xsl:element name="th">Quality Points</xsl:element>
</xsl:element>
<xsl:for-each select="./course">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>

<xsl:template match="course">
<xsl:element name="tr">
<xsl:element name="td"><xsl:value-of
select="./coursenumber"/></xsl:element>
<xsl:element name="td"><xsl:value-of
select="./coursename"/></xsl:element>
<xsl:element name="td"><xsl:value-of
select="./semester"/></xsl:element>
<xsl:element name="td"><xsl:value-of
select="./year"/></xsl:element>
<xsl:element name="td"><xsl:value-of
select="./grade"/></xsl:element>
<xsl:element name="td"><xsl:value-of
select="./credits"/></xsl:element>
<xsl:element name="td"><xsl:value-of
select="./qualitypoints"/></xsl:element>
</xsl:element>
</xsl:template>

<xsl:template match="totals">
<xsl:element name="tr">
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td">
<xsl:attribute
name="align"><xsl:text>right</xsl:text></xsl:attribute>
<xsl:element name="b"><xsl:text>TOTAL
CREDITS:</xsl:text></xsl:element>
</xsl:element>
<xsl:element name="td"><xsl:value-of
select="./credits"/></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
</xsl:element>
<xsl:element name="tr">
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td">
<xsl:attribute
name="align"><xsl:text>right</xsl:text></xsl:attribute>
<xsl:element name="b"><xsl:text>GPA:</xsl:text></xsl:element>
</xsl:element>
<xsl:element name="td"><xsl:value-of
select="./gradepointaverage"/></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
</xsl:element>
<xsl:element name="tr">
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
<xsl:element name="td">
<xsl:attribute
name="align"><xsl:text>right</xsl:text></xsl:attribute>
<xsl:element name="b"><xsl:text>MAX
GPA:</xsl:text></xsl:element>
</xsl:element>
<xsl:element name="td">
<xsl:value-of select="./gradepointaverage/@maximum"/>
</xsl:element>
<xsl:element name="td"><xsl:text> </xsl:text></xsl:element>
</xsl:element>
</xsl:template>

<xsl:template match="notes">
<xsl:for-each select="./note">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>

<xsl:template match="note">
<xsl:element name="p">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>

Does anyone see what might be causing the problem? Any help would be
greatly appreciated.

Thanks

Kevin
 
J

Johannes Koch

nanookfan said:
Hi all,

I'm having a bizarre problem converting XML files to HTML using an
XSLT. The problem is only occuring in my Netscape 7.0 browser. What
makes it more bizarre is that it is only happening when I put my XML
files and the .xsl files on my ISP's system for my home page. If I
try to open the XML files in Netscape 7.0 on my own machine (ie, not
on the ISP's system), the pages convert file and the result is
displayed in HTML.

Under IE 6.0 there is no problem, both when the files are on the ISP's
system or on my own machine.

Perhaps your IPS's web server serves the files with a wrong content-type
header.
 
M

Martin Honnen

nanookfan wrote:

I'm having a bizarre problem converting XML files to HTML using an
XSLT. The problem is only occuring in my Netscape 7.0 browser. What
makes it more bizarre is that it is only happening when I put my XML
files and the .xsl files on my ISP's system for my home page. If I
try to open the XML files in Netscape 7.0 on my own machine (ie, not
on the ISP's system), the pages convert file and the result is
displayed in HTML.

Please post a URL next time and not all that code. As already suggested
the problem is usually the content type the web server sends, see
http://www.mozilla.org/projects/xslt/faq.html
 

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

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top