title: Preventing 2^n - 1 conditionals in XSL 1.0
body: <p>Given the following XML:</p>
  
  <pre><code>&lt;root&gt;
      Pacman &lt;format bold="1" italic="1"&gt;rules&lt;/format&gt;!
  &lt;/root&gt;
  </code></pre>
  
  <p>What is a better implementation than the following, which results in 2<sup>n</sup>-1 possible conditional statements?</p>
  
  <pre><code>&lt;xsl:template match="format"&gt;
      &lt;xsl:choose&gt;
          &lt;xsl:when test="@bold='1' and @italic='1'"&gt;
              &lt;b&gt;&lt;i&gt;&lt;xsl:value-of-select="."/&gt;&lt;/i&gt;&lt;/b&gt;
          &lt;/xsl:when&gt;
          &lt;xsl:when test="@bold='1'"&gt;
              &lt;b&gt;&lt;xsl:value-of-select="."/&gt;&lt;/b&gt;
          &lt;/xsl:when&gt;
          &lt;xsl:when test="@italic='1'"&gt;
              &lt;i&gt;&lt;xsl:value-of-select="."/&gt;&lt;/i&gt;
          &lt;/xsl:when&gt;
      &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>You can see there is a huge problem if I want to add a new possible attribute such as <code>underline="1"</code>, which will result in 4 new conditionals here.</p>
  
  <p><strong>Edit:</strong> Also assume that I cannot use CSS classes and must use HTML tags for styling.</p>