title: Conditional sorting xslt
body: <p>My XML file</p>
  
  <pre><code>&lt;option&gt;
  &lt;options OPT_CD="LAYOUT_SORTBY1_ORDER" OPT_VALUE="DESC"/&gt;
  &lt;/option&gt;
  &lt;data&gt;
  &lt;details name="firstName1" address="lastName1" sortby1="firstName"/&gt;
  &lt;details name="firstName2" address="lastName2" sortby1="firstName"/&gt;
  &lt;details name="firstName3" address="lastName3" sortby1="firstName"/&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>My xslt file</p>
  
  <pre><code>&lt;xsl:choose&gt;
       &lt;xsl:when test="option/options[@OPT_CD='LAYOUT_SORTBY1_ORDER']/@OPT_VALUE='DESC'"&gt;
               &lt;xsl:apply-templates select="/data/details"&gt;
                    &lt;xsl:sort select="./@sortby1" order="descending" /&gt;
               &lt;/xsl:apply-templates&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
             &lt;xsl:apply-templates select="/data/details"&gt;
                  &lt;xsl:sort select="./@sortby1" order="ascending" /&gt;
             &lt;/xsl:apply-templates&gt;
        &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>
  
  <p>My requirement</p>
  
  <p>When option is </p>
  
  <pre><code>OPT_CD="LAYOUT_SORTBY1_ORDER" and OPT_VALUE="DESC"
  </code></pre>
  
  <p>it should select</p>
  
  <pre><code>&lt;xsl:sort select="./@sortby1" order="descending" /&gt;
  </code></pre>
  
  <p>else</p>
  
  <pre><code>&lt;xsl:sort select="./@sortby1" order="ascending" /&gt;
  </code></pre>
  
  <p>Problem:
  I am not getting any error message as well as data is not displayed in descending order with condition. Did i made any mistake? Thanks for any suggestion or solution.</p>