title: XSL get value matching a element
body: <p>I have the below XML fragment:</p>
  
  <pre><code>&lt;process&gt;
    &lt;UserAttr&gt;
      &lt;Name&gt;User1&lt;/Name&gt;
      &lt;Value&gt;username1&lt;/Value&gt;  
      &lt;Name&gt;User2&lt;/Name&gt;
      &lt;Value&gt;username2&lt;/Value&gt;
      &lt;Name&gt;User3&lt;/Name&gt;
      &lt;Value&gt;username3&lt;/Value&gt;
      &lt;Name&gt;User4&lt;/Name&gt;
      &lt;Value&gt;username4&lt;/Value&gt;
    &lt;/UserAttr&gt;
  &lt;/process&gt;
  </code></pre>
  
  <p>The above XML is dynamic and it can have more/less number of Name &amp; Value tags. I would like to have a assign or transform that will allow me to get a respective value matching the Name.</p>
  
  <p>For eg, if I pass <code>User1</code> as a parameter to a XSL transform, it should return the respective  <code>Value</code>, i.e <code>Username1</code>. </p>
  
  <p>I didn't post my XSL because whatever I posted as XML is just a part of my whole XSD and my XSL is very big and I thought it will be very confusing.</p>
  
  <p>Below is how my XSD looks (this is just that part from a big XSD):</p>
  
  <pre><code>&lt;xs:element name="UserAttr" minOccurs="0" maxOccurs="unbounded"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="Value" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
      &lt;xs:attribute name="Name" type="xs:string"/&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>I want to do the below but it throws SelectionFailure Fault. I think i need to assign array size somewhere in the XSD</p>
  
  <pre><code>&lt;assign name="Assign1"&gt;
  &lt;copy&gt;
  &lt;from expression="string('User1')"/&gt;
  &lt;to variable="receiveInput_process_InputVariable_3"
  part="payload" query="/client:process/UserAttr[position()=1]/@Name"/&gt;
  &lt;/copy&gt;
  &lt;copy&gt;
  &lt;from expression="string('User2')"/&gt;
  &lt;to variable="receiveInput_process_InputVariable_3"
  part="payload" query="/client:process/UserAttr[position()=2]/@Name"/&gt;
  &lt;/copy&gt;
  &lt;/assign&gt;
  </code></pre>