![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2004
Posts: 32
OS: XP
|
XML/HTML stylesheet problem
Hi
I have a small XML file which i have written just to use as an example and I have written an XSL file to go with it so that it displays the data in a very simple webpage. However, when i try and open the XML file, it successfully retrieves the required data from the XML file but does not display it in the HTML format specified in the stylesheet (ie. just produces a long string of all the data bunched together and not in a table). I've cut and pasted the XML and XSL files below. I'm new to both XML and HTML so I'm hoping that there is a glaringly obvious mistake one of you will point out. Thanks! Address.xml Code:
<?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 Code:
<?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> Last edited by geeza : 11-11-2005 at 12:36 PM. |
|
|
|
|
|
#2 (permalink) |
|
Professor/Moderator, TSF Design School
Join Date: Jun 2005
Location: Australia
Posts: 2,382
OS: Windows XP SP2
|
I think you'll find the knowledge on XML is very limited here.
I have briefly looked through Google for an answer and have not found anything. I will have another more in-depth look later. ![]() |
|
|
|
|
|
#4 (permalink) |
|
Professor/Moderator, TSF Design School
Join Date: Jun 2005
Location: Australia
Posts: 2,382
OS: Windows XP SP2
|
Sorry I can't seem to find anything that will help you.
![]()
__________________
==========================================
Get Help: TSF Security Forum | HijackThis | MB's 5 Step Process Get Clean: AdAware SE | Spybot S&D | CWShredder | Ewido | CleanUp! Get Protected: SpywareBlaster | SpywareGuard | Windows Updates | IE-SpyAd If TSF has helped you, please consider making a donation to help keep the board running. |
|
|
|
|
|
#5 (permalink) |
|
Manager, On the Web
Join Date: Jan 2004
Location: Bracknell, UK
Posts: 929
OS: XP
|
Hi Geeza,
I also have no idea, but I did a bit of digging in the w3c site and came up with this. http://www.w3schools.com/xsl/el_value-of.asp I'd normally try and work out the answer for you, but I'ev never seen it before.. although it looks a useful tool to read up on. The only other thing I could think of was that you dont have any table tags for the second set of values, just tr and td. Hope that helps a bit. If I read up some more and come up with a definitive solution I'll add that on. Cheers Liam
__________________
![]() My Mother suggested a family outing... so I told her Uncle Bob was gay. (Trevor D.) Never argue with an idiot! They'll bring you down to their level and beat you with experience. --------------------------------------------------------------------------------- A member of the Alliance of Security Analysis Professionals since 2004. |
|
|
|
|
|
#6 (permalink) |
|
Registered User
Join Date: Oct 2004
Posts: 32
OS: XP
|
Hi, thanks for replying!
I think i've sorted it now, i don't really know what i have done to change it but i messed around with the namespaces and it seems to work ok now! Still haven't quite got my head round the whole namespace thing but never mind! |
|
|
|
![]() |
| Thread Tools | |
|
|