title: Assign CSS class to element in an XSL
body: <p>My XML file is as follows:</p>
  
  <pre><code>&lt;worksheet&gt;
  &lt;row&gt;
  &lt;rowTitle&gt;RT1&lt;/rowTitle&gt;
  &lt;rowType&gt;yesorno&lt;/rowType&gt;
  &lt;subLine&gt;subLine1Content&lt;/subLine&gt;
  &lt;subLine&gt;subLine2Content&lt;/subLine&gt;
  &lt;/row&gt;
  &lt;row&gt;
  &lt;rowTitle&gt;RT2&lt;/rowTitle&gt;
  &lt;rowType&gt;operation&lt;/rowType&gt;
  &lt;subLine&gt;subLine1Content&lt;/subLine&gt;
  &lt;subLine&gt;subLine2Content&lt;/subLine&gt;
  &lt;subLine&gt;subLine3Content&lt;/subLine&gt;
  &lt;/row&gt;
  .
  .
  &lt;/worksheet&gt;
  </code></pre>
  
  <p>in my xsl, while displaying contents of a particular row, i'd like to add a class to the html element that'll specify the type of the row it is. I tried using xsl:choose and assigning value to a xsl:variable, but that doesn't work.
  I'm trying to display the row as</p>
  
  <pre><code>&lt;ol&gt;
  &lt;li class="rowTypeBoolean"&gt;
  RT1
  &lt;ul&gt;&lt;li&gt;subLineContent1&lt;/li&gt;
  &lt;li&gt;subLineContent2&lt;/li&gt;&lt;/ul&gt;
  &lt;/li&gt;
  &lt;li class="rowTypeOptions"&gt;
  RT2
  &lt;ul&gt;&lt;li&gt;subLineContent1&lt;/li&gt;
  &lt;li&gt;subLineContent2&lt;/li&gt;
  &lt;li&gt;subLineContent3&lt;/li&gt;&lt;/ul&gt;
  &lt;/li&gt;
  .    
  .
  &lt;/ol&gt;
  </code></pre>
  
  <p>XSL file snippet</p>
  
  <pre><code>&lt;xsl:template match="row"&gt;
          &lt;li class="rowClass ${className}"&gt;
              &lt;xsl:choose&gt;
                  &lt;xsl:when test="type = 'YESORNO'"&gt;
                      &lt;xsl:variable name="className" select="rowTypeBoolean"/&gt;
                  &lt;/xsl:when&gt;
                  &lt;xsl:when test="type = 'OPTIONS'"&gt;
                      &lt;xsl:variable name="className" select="rowTypeOptions"/&gt;
                  &lt;/xsl:when&gt;
                  &lt;xsl:when test="type = 'OPERATION'"&gt;
                       &lt;xsl:variable name="className" select="rowTypeOperation"/&gt;
                  &lt;/xsl:when&gt;
                  &lt;xsl:otherwise&gt;
                      &lt;xsl:variable name="className" select="rowTypeOther"/&gt;
                  &lt;/xsl:otherwise&gt;
              &lt;/xsl:choose&gt;
              &lt;span class="rowTitleClass"&gt;
                  &lt;xsl:value-of select="rowtitle"/&gt;
              &lt;/span&gt;
              &lt;br/&gt;
              &lt;ul class="subLineListClass"&gt;
                  &lt;xsl:apply-templates select="subLine"/&gt;
              &lt;/ul&gt;
          &lt;/li&gt;
  &lt;/xsl:template&gt;
  </code></pre>