The simplest solution is probably to apply templates to the attributes as well as the child elements:
<xsl:template match="header">
<h2 class="format1"><xsl:apply-templates select="node()|@*"/></h2>
</xsl:template>
<xsl:template match="@remark">
<xsl:attribute name="class">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
Note that the class defined using xsl:attribute takes precedence over the one in the literal result element.
You can also achieve this using attribute sets:
<xsl:template match="header">
<h2 use-attribute-sets="class-set">
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:attribute-set name="class-set">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@remark=1">
etc...
In XSLT 2.0 you can use functions:
<xsl:template match="header">
<h2 class="{f:compute-class(.)}">
<xsl:apply-templates/>
</h2>
</xsl:template>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference