title: XSLT - Adding a class to something with a class?
body: <p>When using XSLT how do I apply a class to an element which already has a class? The way I'm doing it it replaces the class that is already present? How would I add the class in addition to the existing class? My code is as follows:</p>
  
  <pre><code>&lt;xsl:if test="data[@alias = 'off'] = 1"&gt;
      &lt;xsl:attribute name="class"&gt;off&lt;/xsl:attribute&gt;
  &lt;/xsl:if&gt;
  &lt;xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"&gt;
      &lt;xsl:attribute name="class"&gt;active&lt;/xsl:attribute&gt;
  &lt;/xsl:if&gt;
  </code></pre>
  
  <p>Thanks.</p>