title: XSLT how to choose a template based on an attribute
body: <p>In a stylesheet I would like to choose a template based on an attribute in the source xml.
  Unfortunately it looks as if one cannot use the mode attribute of apply-templates as this must be a qname literal.
  Is there any other similar way to do this?</p>
  
  <p>Example:</p>
  
  <p>source xml:</p>
  
  <pre><code>...
  &lt;document type="1"&gt;
      &lt;item&gt;...&lt;/item&gt;
  &lt;/document&gt;
  ...
  </code></pre>
  
  <p>stylesheet:</p>
  
  <pre><code>...
  &lt;xsl:template match="document"&gt;
      &lt;xsl:apply-templates select="item" mode="{@type}" /&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="item" mode="1"&gt;
      ...
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="item" mode="2"&gt;
      ...
  &lt;/xsl:template&gt;
  </code></pre>