Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Gropuing Xml

Recommended Posts

I'm doing a course schedule from an data coming from a database.By using an XSL document I'm able to put the XML data output in to a table, fine there.Now I need to group the training dates according to company.here's my XML dump<companycourses><course courseid ="1"><title>MS Windows</title><vendor>Microsoft</vendor><status>fully booked</status><fromdate>01/03/2005</fromdate><todate>05/03/2005</todate></course><course courseid ="2"><title>MS Excel</title><vendor>Microsoft</vendor><status>available</status><fromdate>15/03/2005</fromdate><todate>17/03/2005</todate></course><course courseid ="3"><title>Dreamweaver</title><vendor>Macromedia</vendor><status>fully booked</status><fromdate>01/03/2005</fromdate><todate>05/03/2005</todate></course></companycourses>here's the XSL doc<xsl:stylesheet version="1.0" xmlns:xsl="http://forums.xisto.com/no_longer_exists/ method="html"/><xsl:template match="/"><html><head><title>Training Courses</title></head><body bgcolor="white"><h1>Training courses</h1><TABLE BORDER="1" CELLSPACING="0" CELLPADDING="5"><TR><TD ROWSPAN="2">Vendor</TD><TD ROWSPAN="2">Course Title </TD><TD COLSPAN="2">Date</TD><TD ROWSPAN="2">Status</TD></TR><TR><TD>From</TD><TD>To</TD></TR><xsl:apply-templates/></TABLE></body></html></xsl:template><xsl:template match="course"><TR><TD><xsl:value-of select="vendor"/></TD><TD><xsl:value-of select="title"/></TD><TD><xsl:value-of select="fromdate"/></TD><TD><xsl:value-of select="todate"/></TD><TD><xsl:value-of select="status"/></TD></TR></xsl:template></xsl:stylesheet>At the moment all the courses get outputted but I need them to be grouped according to Vendor, so all the Microsoft courses will output to one table and Macromedia courses to another. Any clues?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.