Jump to content

XML / XSLT on Safari not working


layton

Recommended Posts

I was following the tutorials on XML / XSLT and when previewing the final document (http://www.w3schools.com/xsl/cdcatalog_with_xsl.xml) it appeared correctly....however when copying it directly to my own pages....and testing it....nothing showed up. So I searched to see if Safari supported it....and it's supposed to fully support XSLT. After looking at my code and double checking to see if it was me, I decided to download Camino instead and try that.....works perfectly....so my question is....how do I get it to display properly in Safari? Anyway...here's the code....seems basic enough.The XML

<?xml version="1.0" encoding="iso-8859-1"?><?xml-stylesheet type="text/xsl" href="msgBoard.xsl"?><msgboard><message><topic>My XML message board topic</topic><content>My XML content for when the messages are displayed.</content></message><message><topic>The second topic for the msg board</topic><content>I'm trying to find a way to deliver the message board in a better way.</content></message></msgboard>

The XSL

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">  <html>  <body>	<table border="1">	<xsl:for-each select="msgboard/message">	<tr>	  <td><xsl:value-of select="topic"/></td>	  <td><xsl:value-of select="content"/></td>	</tr>	</xsl:for-each>	</table>  </body>  </html></xsl:template></xsl:stylesheet>

Link to comment
Share on other sites

NOTHING showed up? Not even an error? Just a blank screen?Oh.. tough thing... hm... try it like this:

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/msgboard">  <html>  <body>	<table border="1">	<xsl:for-each select="message">	<tr>	  <td><xsl:value-of select="topic"/></td>	  <td><xsl:value-of select="content"/></td>	</tr>	</xsl:for-each>	</table>  </body>  </html></xsl:template></xsl:stylesheet>

If that doesn't work, I don't know what code will. If it does, then you should report the previous code as a browser bug to Safari.By the way, if you're running the XML locally (not on a web server) check that Security settings don't forbid you to run "active" files locally. Such settings and their failing mechanism vary in browsers, which is why it may work in Camino.

Link to comment
Share on other sites

By the way, if you're running the XML locally (not on a web server) check that Security settings don't forbid you to run "active" files locally. Such settings and their failing mechanism vary in browsers, which is why it may work in Camino.
thanks for the tip....would the security setting be the same issue if internet explorer prompts me for a download when trying to view xml or not.....i'll post this issue in another topic as to not get "off topic" as well but....for some reason....i can see the tutorial xml files fine in IE but when i create them locally it prompts for a file download instead.Cheers
Link to comment
Share on other sites

thanks for the tip....would the security setting be the same issue if internet explorer prompts me for a download when trying to view xml or not.....i'll post this issue in another topic as to not get "off topic" as well but....for some reason....i can see the tutorial xml files fine in IE but when i create them locally it prompts for a file download instead.Cheers
well i think i figured it out ..... sort of....putting the xml file on a web server (as you suggested in a round about way) displays the xml file correctly.....as far as allowing active files to run locally......apparantly my companies IT (computer police) department has removed that option completely from my system. (this option is on my work PC while the Safari issue was on my home mac....for clarity)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...