It's very odd to have this test inside the loop, since its value doesn't depend on anything in the loop: I wonder if this is what you really intended?
<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:templateId/@root='2.16.840.1.113883.10.20.1.8'">
I can't see any reason for an extraneous comma (but there's way too much detail here for me to study). Are you looking at the HTML output as source, or as displayed in the browser? If you generate badly structured HTML tables, browsers can sometimes display text in very peculiar places.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference