I can't see anything immediately wrong with your code. Your expression
<xsl:if test="./n1:section/n1:templateId/@root='2.16.840.1.113883.10.20.1.8'">
is equivalent to Sam's
test="./n1:section/n1:templateId[@root='2.16.840.1.113883.10.20.1.8']">
When you're dealing with a schema as complex as these healthcare vocabularies, there can be a lot of benefit in the XSLT 2.0 feature of writing schema-aware stylesheets. If you get into the habit of using schema-aware types in your match patterns and variable declarations, a lot of coding mistakes will be reported at compile time that otherwise take hours of run-time debugging.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference