title: Is there a way to use mode in an xsl:if test?
body: <p>I've been learning to use the mode attribute with XSLT and was wondering if there's a way to test for it within a template, such as in an xsl:if statement? I've only seen it used at the xsl:template level and maybe that's the only way. Say I want to add a "../" in front of a path attribute (@href), but only if mode="print":</p>
  
  <pre><code>     &lt;xsl:template name="object" mode="#all"&gt;
          &lt;img&gt;
           &lt;xsl:attribute name="src"&gt;
            &lt;xsl:if test="mode='print'"&gt;&lt;xsl:text&gt;../&lt;/xsl:text&gt;&lt;/xsl:if&gt;
            &lt;xsl:value-of select="@href"/&gt;
           &lt;/xsl:attribute&gt;
          &lt;/img&gt;
       &lt;/xsl:template&gt;
  </code></pre>
  
  <p>I'm calling apply-templates with and without the mode="print" set from various other templates.</p>
  
  <p>Of course I can make a new template with mode="print" but then I'd have to maintain two templates.</p>
  
  <p>Or maybe there's a better way to do this? Thanks for the help. - Scott</p>