title: xpath question on selecting node set
body: <p>Here is a simplified version of my source xml document:</p>
  
  <pre><code>&lt;eml&gt; 
  &lt;additionalMetadata&gt;
      &lt;describes&gt;sbclter.380&lt;/describes&gt;
      &lt;access authSystem="knb" order="denyFirst"&gt;
        &lt;allow&gt;
          &lt;principal&gt;public&lt;/principal&gt;
          &lt;permission&gt;all&lt;/permission&gt;
        &lt;/allow&gt;
      &lt;/access&gt;
    &lt;/additionalMetadata&gt;
  
    &lt;additionalMetadata&gt;
      &lt;describes&gt;sbclter.415&lt;/describes&gt;
      &lt;describes&gt;sbclter.380&lt;/describes&gt;
        &lt;access authSystem="knb" order="allowFirst"&gt;
          &lt;allow&gt;
            &lt;principal&gt;public&lt;/principal&gt;
            &lt;permission&gt;all&lt;/permission&gt;
          &lt;/allow&gt;
        &lt;/access&gt;
    &lt;/additionalMetadata&gt;
  
    &lt;additionalMetadata&gt;
          &lt;describes&gt;sbclter.415&lt;/describes&gt;
          &lt;access authSystem="knb" order="allowFirst"&gt;
              &lt;allow&gt;
                &lt;principal&gt;public&lt;/principal&gt;
                &lt;permission&gt;all&lt;/permission&gt;
              &lt;/allow&gt;
            &lt;/access&gt;
      &lt;/additionalMetadata&gt;
   &lt;eml&gt;
  </code></pre>
  
  <p>I want to select a node set of element "describes" - its value shows in more than one addtionalMetadata block and its "access" sibling has different order: "denyFirst" and "allowFirst".</p>
  
  <p>In above example, the "describes" with value sbclter.380 is the case. Since it shows in two additionalMetadata block, the first one has "denyFirst" in access sibling, but the second one has "allowFirst" in access sibling. sbclter.415 would NOT be the case. Since it shows up in two additionalMetadata block, but both access siblings has the same value "allowFirst" at the attribute "order".</p>
  
  <p>After transformation, i want get:</p>
  
  <pre><code>&lt;eml&gt; 
      &lt;additionalMetadata&gt;
          &lt;describes&gt;sbclter.380&lt;/describes&gt;
          &lt;access authSystem="knb" order="denyFirst"&gt;
            &lt;allow&gt;
              &lt;principal&gt;public&lt;/principal&gt;
              &lt;permission&gt;all&lt;/permission&gt;
            &lt;/allow&gt;
          &lt;/access&gt;
        &lt;/additionalMetadata&gt;
  
        &lt;additionalMetadata&gt;
          &lt;describes&gt;sbclter.380&lt;/describes&gt;
            &lt;access authSystem="knb" order="allowFirst"&gt;
              &lt;allow&gt;
                &lt;principal&gt;public&lt;/principal&gt;
                &lt;permission&gt;all&lt;/permission&gt;
              &lt;/allow&gt;
            &lt;/access&gt;
        &lt;/additionalMetadata&gt;
  
        &lt;additionalMetadata&gt;
              &lt;access authSystem="knb" order="allowFirst"&gt;
                  &lt;allow&gt;
                    &lt;principal&gt;public&lt;/principal&gt;
                    &lt;permission&gt;all&lt;/permission&gt;
                  &lt;/allow&gt;
                &lt;/access&gt;
          &lt;/additionalMetadata&gt;
       &lt;eml&gt;
  </code></pre>
  
  <p>Here is my node:</p>
  
  <pre><code>   &lt;xsl:for-each select="/*/*"&gt;
          &lt;xsl:choose&gt;
             &lt;xsl:when test="name()='additionalMetadata'"&gt;
              &lt;xsl:call-template name="handle-describe-access-in-additional-metadata"&gt;
                  &lt;xsl:with-param name="describes-list" select="./describes[//additionalMetadata[describes = . and access[@order='allowFirst']] and //additionalMetadata[describes = . and access[@order='denyFirst']]]"
            &gt;&lt;/xsl:with-param&gt;
                &gt;&lt;/xsl:with-param&gt;
              &lt;/xsl:call-template&gt;
            &lt;/xsl:when&gt;
          &lt;/xsl:choose&gt;
        &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>However,it doesn't work. The xpath in "xsl:with-param" picked up nothing - no  sbclter.415 either sbclter.380. Do you have any suggestion? Thank you  so much!</p>
  
  <p>Note: this is simplified version of code. </p>