R
Rohit
I have a XML which looks like this:
<root>
<row Site="ABC" ClassroomName="Calculus" StartDate="Jun 1 2004"/>
<row Site="ABC" ClassroomName="Biology" StartDate="Jun 10 2004"/>
<row Site="XYZ" ClassroomName="History" StartDate="Jun 12 2004"/>
<row Site="XYZ" ClassroomName="English" StartDate="Jun 1 2004"/>
</root>
I want this to be displayed in a <table> as
----------------------------------------------
ABC
ClassroomName StartDate
Calculus June 1 2004
Biology June 10 2004
XYZ
ClassroomName StartDate
History June 12 2004
English June 1 2004
----------------------------------------------
As you can see, the 'Site' goes first, then we have column headings
for Classroom and Date, then the rows belonging to that 'site'. The
XML is always sorted on 'Site'.
This is what I have been come up with:
------------------------------------------------------------------------------
<xsl:template match="/">
<table width="100%">
<tr>
<td><b>Site</b></td>
<td><b>ClassroomName</b></td>
<td><b>Start Date</b></td>
</tr>
<xsl:apply-templates select="ROOT/row" />
</table>
</xsl:template>
<xsl:template match="ROOT/row">
<tr>
<td><xsl:value-of select="@Site"></xsl:value-of></td>
<td><xsl:value-of select="@ClassroomName"></xsl:value-of></td>
<td><xsl:value-of select="@StartDate"></xsl:value-of>
</tr>
</xsl:template>
--------------------------------------------------------------------
Can somebody please advice me how to get the above formatting by
modifying this xsl template.
Thanks,
Rohit
<root>
<row Site="ABC" ClassroomName="Calculus" StartDate="Jun 1 2004"/>
<row Site="ABC" ClassroomName="Biology" StartDate="Jun 10 2004"/>
<row Site="XYZ" ClassroomName="History" StartDate="Jun 12 2004"/>
<row Site="XYZ" ClassroomName="English" StartDate="Jun 1 2004"/>
</root>
I want this to be displayed in a <table> as
----------------------------------------------
ABC
ClassroomName StartDate
Calculus June 1 2004
Biology June 10 2004
XYZ
ClassroomName StartDate
History June 12 2004
English June 1 2004
----------------------------------------------
As you can see, the 'Site' goes first, then we have column headings
for Classroom and Date, then the rows belonging to that 'site'. The
XML is always sorted on 'Site'.
This is what I have been come up with:
------------------------------------------------------------------------------
<xsl:template match="/">
<table width="100%">
<tr>
<td><b>Site</b></td>
<td><b>ClassroomName</b></td>
<td><b>Start Date</b></td>
</tr>
<xsl:apply-templates select="ROOT/row" />
</table>
</xsl:template>
<xsl:template match="ROOT/row">
<tr>
<td><xsl:value-of select="@Site"></xsl:value-of></td>
<td><xsl:value-of select="@ClassroomName"></xsl:value-of></td>
<td><xsl:value-of select="@StartDate"></xsl:value-of>
</tr>
</xsl:template>
--------------------------------------------------------------------
Can somebody please advice me how to get the above formatting by
modifying this xsl template.
Thanks,
Rohit