|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
XML and Netscape 6
Hello,
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: example.xml: <?xml version="1.0"?> <?xml:stylesheet type="text/xsl" href="example_stylesheet.xsl"?> <me> <name>John Doe</name> <address>94, Main Street, Nowheresville 16463, XY</address> <tel>738 2838</tel> <email>johndoe@black.hole.com</email> <url>URL</url> </me> and here is the example_stylesheet.xsl: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head></head> <body> <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" /> </body> </html> </xsl:template> </xsl:stylesheet> When I load the example.xml page in netscape, I get the following output: John Doe 94, Main Street, Nowheresville 16463, XY 738 2838 URL URL 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 output. 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?? Brady |
|
#2
|
|||
|
|||
|
Netscape and xsl
After playing around a bit, using an example from mozzilla.org that worked correctly, I found that when adding HTML you need the following tag:
<xsl utput method="html" /> A working stylesheet (Netscape 6.2 & Internet Explorer 6) follows: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="foo"/> <!-- FileName: MATCH01 --> <!-- Document: URL --> <!-- DocVersion: 19991116 --> <!-- Section: 2.5 --> <!-- Creator: David Marston --> <!-- Purpose: Test for //name match pattern. --> <!-- set the output properties --> <xsl utput method="html" /> <xsl:template match="doc"> <xsl:apply-templates/> </xsl:template> <xsl:template match="foo/bar//baz"> <FONT COLOR="blue"><xsl:value-of select="@att1"/></FONT> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> The corresponding xml is: <?xml version="1.0"?> <?xml-stylesheet href="select.xsl" type="text/xsl"?> <doc> <foo att1="c"> <bar att1="b"> <foo att1="a"> <baz att1="right"/> </foo> </bar> <foo att1="a"> <baz att1="wrong"/> </foo> </foo> </doc> |
|
#3
|
|||
|
|||
|
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). Last edited by caf : January 25th, 2002 at 05:14 PM. |
|
#4
|
|||
|
|||
|
<?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"?> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML and Netscape 6 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|