steve_marjoribanks Posted November 12, 2005 Share Posted November 12, 2005 Hi everyone, i'm hoping you can help me with a small code problem. I'm new to both HTML and XML and i've written just a very small .xml file to practice. I've also created an .xsl stylesheet which should display the data in a simple table in HTML. However when i open the file address.xml in internet explorer, the data has been sucessfully extracted from the XML file but it is just displayed as a long string of text not in the table as the stylesheet says. Basically, the HTML part isnt working for some reason. Hope you can help! Thanks :)Address.xml <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="Address.xsl" ?><AddressBook xmlns="http://tempuri.org/Address.xsd" schemaLocation="Address.xsd"> <Person> <FirstName>Stephen</FirstName> <Surname>Marjoribanks</Surname> <University>Durham</University> <College>Trevelyan</College> </Person> <Person> <FirstName>Joe</FirstName> <Surname>Bloggs</Surname> <University>Leeds</University> <College /> </Person></AddressBook> Address.xsl <?xml version="1.0" encoding="UTF-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/AddressBook"> <HTML> <HEAD> <TITLE>Address Book</TITLE> </HEAD> <BODY> <H1>Address Book</H1><br/> <HR/> <TABLE BORDER="1"> <TD>First Name</TD> <TD>Surname</TD> <TD>University</TD> <TD>College</TD> <xsl:apply-templates/> </TABLE> </BODY> </HTML> </xsl:template> <xsl:template match="Person"> <TR> <TD> <xsl:value-of select="FirstName" /> </TD> <TD> <xsl:value-of select="Surname" /> </TD> <TD> <xsl:value-of select="University" /> </TD> <TD> <xsl:value-of select="College" /> </TD> </TR> </xsl:template> </xsl:stylesheet> Link to comment Share on other sites More sharing options...
steve_marjoribanks Posted November 13, 2005 Author Share Posted November 13, 2005 Noone? Link to comment Share on other sites More sharing options...
sbirlevm Posted November 14, 2005 Share Posted November 14, 2005 Hi Steve, try to remove the xmlns="http://tempuri.org/Address.xsd"namespace-attribute from the XML file, and your sample should work.regards, good luck Link to comment Share on other sites More sharing options...
steve_marjoribanks Posted November 17, 2005 Author Share Posted November 17, 2005 Hi Steve, try to remove the xmlns="http://tempuri.org/Address.xsd"namespace-attribute from the XML file, and your sample should work.regards, good luck<{POST_SNAPBACK}> Ahh thanks! I thought it might be a namespace issue. I haven't really got my head round the whole namespace thing yet! Link to comment Share on other sites More sharing options...
Nick Posted November 17, 2005 Share Posted November 17, 2005 Also, you may want to make your html tags all lower-case, which is the proper way for current and future versions of (x)html. Link to comment Share on other sites More sharing options...
croatiankid Posted September 16, 2007 Share Posted September 16, 2007 Also, you may want to make your html tags all lower-case, which is the proper way for current and future versions of (x)html.This is only true for xhtml. Current and future versions of HTML allow a mix of upper and lower case tags see here. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now