title: Optimizing my XSLT selector
body: <p>i'm using the orbeon form builder and want to add a value to the class attribute of some elements. To do this i'm using the code below, but i would like to know how to optimize this code. It must be possible to combine each 2 template tags, because the only difference is that is case 1 i set the class attribute to a value, and in case 2 i add some text to the class attribute..</p>
  
  <p>Maybe it is even possible to combine all this code into 1 template tag? (one with multiple selectors (match) and with the set/append class attribute?</p>
  
  <pre><code>Case 1: 
     &lt;xsl:template match="xforms:input/@id"&gt;
          &lt;xsl:attribute name="id" select="."/&gt; 
          &lt;xsl:attribute name="class"&gt;tsbinput-&lt;xsl:value-of select="."/&gt;&lt;/xsl:attribute&gt;      
     &lt;/xsl:template&gt; 
  Case 2:
     &lt;xsl:template match="xforms:input/@class"&gt;
          &lt;xsl:attribute name="class"&gt;&lt;xsl:value-of select="."/&gt; tsbinput-&lt;xsl:value-of select="../@id"/&gt;&lt;/xsl:attribute&gt;      
     &lt;/xsl:template&gt;
  
  Case 1:    
      &lt;xsl:template match="fr:number/@id"&gt;
          &lt;xsl:attribute name="id" select="."/&gt; 
          &lt;xsl:attribute name="class"&gt;tsbinput-&lt;xsl:value-of select="."/&gt;&lt;/xsl:attribute&gt;      
     &lt;/xsl:template&gt; 
  Case 2:
     &lt;xsl:template match="fr:number/@class"&gt;
          &lt;xsl:attribute name="class"&gt;&lt;xsl:value-of select="."/&gt; tsbinput-&lt;xsl:value-of select="../@id"/&gt;&lt;/xsl:attribute&gt;      
     &lt;/xsl:template&gt;
  
  Case 1:
     &lt;xsl:template match="fr:textcount/@id"&gt;
          &lt;xsl:attribute name="id" select="."/&gt; 
          &lt;xsl:attribute name="class"&gt;tsbinput-&lt;xsl:value-of select="."/&gt;&lt;/xsl:attribute&gt;      
     &lt;/xsl:template&gt; 
  Case 2:
     &lt;xsl:template match="fr:textcount/@class"&gt;
          &lt;xsl:attribute name="class"&gt;&lt;xsl:value-of select="."/&gt; tsbinput-&lt;xsl:value-of select="../@id"/&gt;&lt;/xsl:attribute&gt;      
     &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Please help me. 
  Thanks, Nico</p>