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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 11-11-2005, 12:33 PM   #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.
geeza is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 11-16-2005, 10:59 PM   #2 (permalink)
Professor/Moderator, TSF Design School
 
Grove's Avatar
 
Join Date: Jun 2005
Location: Australia
Posts: 2,383
OS: Windows Vista SP2 32bit


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.
Grove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-17-2005, 05:13 AM   #3 (permalink)
Registered User
 
Join Date: Oct 2004
Posts: 32
OS: XP


Yeah i guessed that from the response! Thanks :)
geeza is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-19-2005, 11:33 PM   #4 (permalink)
Professor/Moderator, TSF Design School
 
Grove's Avatar
 
Join Date: Jun 2005
Location: Australia
Posts: 2,383
OS: Windows Vista SP2 32bit


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.
Grove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-24-2005, 01:13 PM   #5 (permalink)
Manager, On the Web
 
E-Liam's Avatar
 
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.
E-Liam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-25-2005, 03:25 AM   #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!
geeza is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 02:58 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85