Forums Forums (
-   HTML, PHP, MySQL, Graphics, Coding (
-   -   XSL: Doing something wrong? (

David Ikari 17-10-2009 09:08 PM

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)>
                                <!ATTLIST flight ID CDATA #REQUIRED>
                                <!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?

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

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