Before anyone asks, this is not homework, I am trying to teach myself xml using SAMS textbook. I am working with an xml file that has several dates listed for each room. I am trying to list the room, followed by all of the dates that it has been booked for. I can sucessfully list each room, however, I can only get one date to show up per room. What can I do in order to list all of the dates the room was booked for? Do I manually need to add each one or is there a way to do a list all?
Here is what I have now:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl
utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="bookings">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="room">
<p>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="date/month"/>
<xsl:value-of select="date/day"/>
<xsl:value-of select="date/year"/>
</p>
</xsl:template>
</xsl:stylesheet>
And here is a sample of one of the rooms and dates from the xml I am working with:
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="D:\ISM 660\Assignment 3\Solutions\Question 1\Question 1.xslt?>
<!-- fictional today's date: 2000/06/23 -->
<bookings>
<lastUpdated date='20000623' time='1317'/>
<room name='Red'>
<date>
<year>2000</year>
<month>June</month>
<day>23</day>
<meeting>
<period>
<from>1300</from>
<to>1330</to>
</period>
<bookedBy>John Smith</bookedBy>
<attendees>
<attendee><individual>Jennifer Platt</individual></attendee>
<attendee><group>NewBieNetGroup</group></attendee>
<attendee><individual>Peter Shanahan</individual></attendee>
<attendee><individual>Susan Zak</individual></attendee>
</attendees>
<meetingTitle>Project Status</meetingTitle>
<purpose>The client is not very happy about the pace of
development. This meeting is booked to find out the actual
status of the project before we get back to the
client.</purpose>
<bookedAt date='20000413' time='1004'/>
<reminder><email>jsmith@peacockpaint.com</email></reminder>
</meeting>
<meeting>
<period>
<from>1430</from>
<to>1530</to>
</period>
<bookedBy>Jon Khan</bookedBy>
<attendees>
<attendee><group>Pheasants</group></attendee>
</attendees>
<meetingTitle>Javascript Code Review</meetingTitle>
<purpose>We will review the Javascript of
the "Golden Pheasant Pub" web site.</purpose>
<bookedAt date='20000324' time='1534'/>
</meeting>
</date>
<date>
<year>2000</year>
<month>July</month>
<day>10</day>
<meeting>
<period>
<from>0730</from>
<to>0900</to>
</period>
<bookedBy>Joan Leclair</bookedBy>
<attendees>
<attendee><group>Project Managers</group></attendee>
</attendees>
<meetingTitle>Breakfast Meeting for Future
Projects</meetingTitle>
<purpose>We will start development for five projects in
August. We must meet to dicuss coordination among ourselves on how
these projects can be handled properly.</purpose>
<bookedAt date='20000328' time='1657'/>
</meeting>
</date>
</room>
Here is what I have now:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl
<xsl:template match="bookings">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="room">
<p>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="date/month"/>
<xsl:value-of select="date/day"/>
<xsl:value-of select="date/year"/>
</p>
</xsl:template>
</xsl:stylesheet>
And here is a sample of one of the rooms and dates from the xml I am working with:
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="D:\ISM 660\Assignment 3\Solutions\Question 1\Question 1.xslt?>
<!-- fictional today's date: 2000/06/23 -->
<bookings>
<lastUpdated date='20000623' time='1317'/>
<room name='Red'>
<date>
<year>2000</year>
<month>June</month>
<day>23</day>
<meeting>
<period>
<from>1300</from>
<to>1330</to>
</period>
<bookedBy>John Smith</bookedBy>
<attendees>
<attendee><individual>Jennifer Platt</individual></attendee>
<attendee><group>NewBieNetGroup</group></attendee>
<attendee><individual>Peter Shanahan</individual></attendee>
<attendee><individual>Susan Zak</individual></attendee>
</attendees>
<meetingTitle>Project Status</meetingTitle>
<purpose>The client is not very happy about the pace of
development. This meeting is booked to find out the actual
status of the project before we get back to the
client.</purpose>
<bookedAt date='20000413' time='1004'/>
<reminder><email>jsmith@peacockpaint.com</email></reminder>
</meeting>
<meeting>
<period>
<from>1430</from>
<to>1530</to>
</period>
<bookedBy>Jon Khan</bookedBy>
<attendees>
<attendee><group>Pheasants</group></attendee>
</attendees>
<meetingTitle>Javascript Code Review</meetingTitle>
<purpose>We will review the Javascript of
the "Golden Pheasant Pub" web site.</purpose>
<bookedAt date='20000324' time='1534'/>
</meeting>
</date>
<date>
<year>2000</year>
<month>July</month>
<day>10</day>
<meeting>
<period>
<from>0730</from>
<to>0900</to>
</period>
<bookedBy>Joan Leclair</bookedBy>
<attendees>
<attendee><group>Project Managers</group></attendee>
</attendees>
<meetingTitle>Breakfast Meeting for Future
Projects</meetingTitle>
<purpose>We will start development for five projects in
August. We must meet to dicuss coordination among ourselves on how
these projects can be handled properly.</purpose>
<bookedAt date='20000328' time='1657'/>
</meeting>
</date>
</room>