Apply classes to selected XHTML elements based on content
You could just create the class based on the value of the td.

Input (I added a td that should not be modified by the stylesheet.)

&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"&gt;
    &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;title&gt;Title&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;table class="mytable"&gt;
            &lt;tr&gt;
                &lt;td&gt;A1&lt;/td&gt;
                &lt;td&gt;A2&lt;/td&gt;
                &lt;td&gt;B1&lt;/td&gt;
                &lt;td&gt;B2&lt;/td&gt;
                &lt;td&gt;C1&lt;/td&gt;
                &lt;td&gt;C2&lt;/td&gt;
                &lt;td&gt;ignore me&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/body&gt;
&lt;/html&gt;


XSLT 2.0

&lt;xsl:stylesheet version="2.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xpath-default-namespace="http://www.w3.org/1999/xhtml"&gt;
  &lt;xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/&gt;
  &lt;xsl:strip-space elements="*"/&gt;

  &lt;xsl:param name="tds" select="('A2','B1','B2','C1','C2')"/&gt;

  &lt;xsl:template match="@*|node()"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="td[normalize-space()=$tds]"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:attribute name="class" 
        select="concat('mytable-',lower-case(normalize-space()))"/&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;


Output

&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"&gt;
   &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
      &lt;title&gt;Title&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
      &lt;table class="mytable"&gt;
         &lt;tr&gt;
            &lt;td class="foo"&gt;A1&lt;/td&gt;
            &lt;td class="mytable-a2"&gt;A2&lt;/td&gt;
            &lt;td class="mytable-b1"&gt;B1&lt;/td&gt;
            &lt;td class="mytable-b2"&gt;B2&lt;/td&gt;
            &lt;td class="mytable-c1"&gt;C1&lt;/td&gt;
            &lt;td class="mytable-c2"&gt;C2&lt;/td&gt;
            &lt;td&gt;ignore me&lt;/td&gt;
         &lt;/tr&gt;
      &lt;/table&gt;
   &lt;/body&gt;
&lt;/html&gt;


Notes:


In my match, I didn't use the // abbreviated syntax (match="//td"); I just used match="td".
I used xsl:param instead of using the sequence ('A2','B1','B2','C1','C2') directly in the match so that it could be passed in at runtime. This would allow you to change which td elements were modified without changing the actual code.
Try to use a select attribute on xsl:attribute, even when outputting plain text (&lt;xsl:attribute name="class" select="'mytable-c2'"/&gt;). This prevents creating unnecessary RTF's (result tree fragments).
I use normalize-space() when creating the class to strip any leading/trailing whitespace in the text() node.
After creating the class attribute, we do an xsl:apply-templates on @*. If there is an existing class attribute, it will overwrite what we just created. If this is a possibility, I'd do an xsl:apply-templates on @*, then create the new class attribute (overwrites the existing class or you can concat the new and old), and then finally do the xsl:apply-templates on node().