Jump to content

Transforming xml to html in browsers


Malcolm2

Recommended Posts

Hi. My question is Why am I having no luck transforming a xml file into a html presentation using xslt in a browser?I thought that the uptodate browsers Net 8.1 7.2 and IE6 allowed you to transform a xml file with only a processing instruction in the xml file,assuming that both the xml and xslt were in the same folder on your hard drive.I am missing something and can not find this simple answer anywhere. I am not interested in the server side but just want to build and learn xml. xslt . xslt-fo and svg on my computer. ...Malcolm

Link to comment
Share on other sites

You've guessed correct as to how the procedure works. Could you give some code? Maybe you have some error which is why you can't preview the result.

Link to comment
Share on other sites

You've guessed correct as to how the procedure works. Could you give some code? Maybe you have some error which is why you can't preview the result.
Thanks ,,sometimes asking the question seems to solve the problem ... now I am having no problems displaying my simple table in net 7.2 ,... I don't know what I was doing wrong before , I reviewed xhmlt and noticed that small letters might be required html oposed to HTML, but that was all I changed...
<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" version="1.0"/><xsl:template match="/"> <html> <body>   <h1>List 2007</h1>  <table border="2">   <tr>    <th>Name</th>    <th>Phone</th>   </tr><xsl:for-each select="Members/Member">   <tr>    <td><xsl:value-of select="Name"/></td>    <td><xsl:value-of select="Phone"/></td>   </tr></xsl:for-each>  </table> </body>  </html></xsl:template></xsl:stylesheet>

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="file:///C:/My%20Documents/Test4.xsl"?> <Members>  <Member>   <Name>Bob Bobb</Name>   <Phone>123.234.4567</Phone>  </Member>  <Member>   <Name>Susan Day</Name>   <Phone>345.123.6789</Phone>  </Member> </Members>

Thanks for answer confirming that I was doing it right. I have been out of the coding loop for a couple of years and have decided to dive back in now that w3 standards are becoming common place. This point was what drove me away before as my xhmtl and css2 prefect websites were impossible to sell and convince people of the future benefits. Thanks ,I can't wait for my next question for you...Malcolm

Link to comment
Share on other sites

Yes. XHTML requres lower case letters, though I would have never believed that would be a problem when you haven't specified a DTD in the xsl:output element. Scince you've solved the problem, there was no need for the code though :) .

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