Thread Tools
Old 17-10-2009, 09:08 PM   #1   [permalink]
David Ikari
Forum Master
David Ikari's Avatar
Join Date: 26 Jun 2000
Location: Newcastle, Australia
Posts: 2,388
XSL: Doing something wrong?

Might be the wrong place, might be a dumb question. But I'll ask it, 'cause that's what I'm here for!

I'm working with XSLT, trying to format an XML document. I'm in the middle of learning it for fun (using a friends uni exercises). For some reason, I can't get any xslt command to work beyond a particular section of code (excluding apply-template). Anyone able to help me figure out what's going on?

PS: airline.xml has passed W3C markup validation.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="airline-xslt.xsl"?>
<!DOCTYPE bookings [
<!ELEMENT bookings (passenger*)>
	<!ELEMENT passenger (id, address, leg+)>
		<!ELEMENT id (surname, given, initial)>
			<!ELEMENT surname (#PCDATA)>
			<!ELEMENT given (#PCDATA)>
			<!ELEMENT initial (#PCDATA)>
		<!ELEMENT address (property, street, suburb, telephone)>
			<!ELEMENT property (#PCDATA)>
			<!ELEMENT street (#PCDATA)>
			<!ELEMENT suburb (#PCDATA)>
			<!ATTLIST suburb postcode CDATA #IMPLIED>
			<!ELEMENT telephone (#PCDATA)>
		<!ELEMENT leg (date, flight)>
			<!ELEMENT date (day, month)>
				<!ELEMENT day (#PCDATA)>
				<!ELEMENT month (#PCDATA)>
					<!ATTLIST month year CDATA #REQUIRED>
			<!ELEMENT flight (arrive, depart, grade, aircraft)>
				<!ELEMENT arrive EMPTY>
					<!ATTLIST arrive airportID CDATA #REQUIRED>
					<!ATTLIST arrive time CDATA #REQUIRED>
				<!ELEMENT depart EMPTY>
					<!ATTLIST depart airportID CDATA #REQUIRED>
					<!ATTLIST depart time CDATA #REQUIRED>
				<!ELEMENT grade EMPTY>
					<!ATTLIST grade type CDATA #REQUIRED>
				<!ELEMENT aircraft EMPTY>
					<!ATTLIST aircraft ID CDATA #IMPLIED>

			<property>University of Newcastle</property>
			<street>University Drive</street>
			<suburb postcode="2308">CALLAGHAN</suburb>
				<month year="2003">August</month>
			<flight ID="QF005">
				<arrive airportID="SIN" time="21:35"/>
				<depart airportID="SYD" time="15:45"/>
				<grade type="Economy"/>
				<aircraft ID="744"/>
				<month year="2003">August</month>
			<flight ID="QF010">
				<arrive airportID="MEL" time="04:55"/>
				<depart airportID="SIN" time="19:45"/>
				<grade type="Economy"/>
				<month year="2003">August</month>
			<flight ID="QF434">
				<arrive airportID="SYD" time="14:20"/>
				<depart airportID="MEL" time="13:00"/>
				<grade type="Business"/>
				<aircraft ID="73H"/>
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"

<xsl:template match="bookings">

  <html xml:lang="en" lang="en">

    <title>Banana Airline Bookings</title>


    <h1>Welcome to Banana Airlines</h1>
		<xsl:value-of select="passenger/id" />
		<xsl:value-of select="passenger/address" />

select="passenger/address/suburb/@postcode" />
		<xsl:for-each select="passenger/leg">
			<xsl:value-of select="date" />
			<xsl:value-of select="date/month/@year" />
			<xsl:value-of select="flight" />


    <xsl:apply-templates select="bookings" />




Problem: <xsl:value-of select="flight" /> Doesn't return any value no matter where it is placed, or how I try and read it. Any help?
David Ikari is offline   Reply With Quote

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong? Nairohe General Non-Anime Discussion Archive 2000-2003 9 29-03-2002 02:58 PM

New To Site? Need Help?

All times are GMT -4. The time now is 08:41 AM.

Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2020, vBulletin Solutions, Inc.