This is not the way to write XSLT:
<xsl:text disable-output-escaping="yes">
<tr>
</xsl:text>
XSLT is a language for transforming input trees into result trees. The result tree is then (optionally) sent to a serializer to be turned into serial XML. Very occasionally you need to prod the serializer to do something unusual, and that is the only time you should use disable-output-escaping. What you are trying to do here is to bend XSLT into a language for writing textual XML, in the form of tags, and you are getting yourself into a mess as a result.
Writing a node to a tree is an atomic action, achieved using a literal result element if it's name is known statically, or xsl:element if not. You don't write one half of the node at one time, and the other half later.
To write a table with data items arranged four per row, your logic should look like this:
<table>
for each group of four items
<tr>
for each of the four items
<td>
output the item
for example
<table>
<xsl:for-each select="Course[position() mod 4 = 1]">
<tr>
<xsl:for-each select=".|following-sibling::Course[position() < 4]">
<td>
<xsl:apply-templates/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
Sorry not to help you with your immediate problem, but this code is no place to start from.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference