title: Assign CSS class to HTML tags generated with SQL 'FOR XML'
body: <p>I am getting table rows and table data (with HTML tags) from SQL using 'FOR XML'. Is there a way I could assign CSS classes to the html tags in SQL?</p>
  
  <p>What I am currently getting:
  <code>&lt;tr&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Value&lt;/td&gt;&lt;/tr&gt;</code></p>
  
  <p>SQL query:</p>
  
  <pre><code>SELECT  (SELECT [Name] as [td] FOR XML PATH(''), type),
          (SELECT [Value] as [td] FOR XML PATH(''), type)
  FROM    table
  FOR XML PATH('tr')
  </code></pre>
  
  <p>Desired output:</p>
  
  <p><code>&lt;tr class="test1"&gt;
      &lt;td class="test2"&gt;Name&lt;/td&gt;
      &lt;td class="test3"&gt;Value&lt;/td&gt;
  &lt;/tr&gt;</code></p>