title: Select Nodes using key() based on Condition
body: <p>I have a situation where I need to select the nodes based on certain conditions and then apply Muenchian grouping to get unique values. I am on XSLT 1.0</p>
  
  <pre><code>&lt;Parent&gt;
      &lt;Child&gt;
          &lt;A&gt;&lt;/A&gt;
          &lt;B&gt;&lt;/B&gt;
          &lt;C&gt;&lt;/C&gt;
      &lt;/Child&gt;
      &lt;Child&gt;
          &lt;A&gt;&lt;/A&gt;
          &lt;B&gt;&lt;/B&gt;
          &lt;C&gt;&lt;/C&gt;
      &lt;/Child&gt;
      &lt;Child&gt;
          &lt;A&gt;&lt;/A&gt;
          &lt;B&gt;&lt;/B&gt;
          &lt;C&gt;&lt;/C&gt;
      &lt;/Child&gt;
  &lt;/Parent&gt;
  </code></pre>
  
  <p>The Condition that I have for use attribute is: 
  If A is not blank, use A. Otherwise use B.</p>
  
  <p>I had thought of a solution that would work for Fixed Width values for Node A and B. So If A and B are of length n, I can do something like this:</p>
  
  <pre><code>&lt;xsl:key name="groupKey" match="/Parent/Child" use="substring(concat(A,B),1,n)"&gt;
  </code></pre>
  
  <p>So, If A is not present, I can use B. But I haven't been able to figure out how to use string-length() to derive the expression for variable lengths for A and B. Any Ideas?</p>