title: Position function return value not able to index a specific node in a collection
body: <p>I have the below XSLT which works fine:</p>
  
  <pre><code>  &lt;xsl:template match="/*"&gt;
      &lt;root&gt;
        &lt;xsl:variable name="AddressNames" select="myUtil:getSecondXMLData()"/&gt;
        &lt;xsl:for-each select="item"&gt;
          &lt;AddressName&gt;
            &lt;xsl:variable name="curValue" select="position()"/&gt;
            &lt;xsl:value-of select="$AddressNames//Item[$curValue]/names"/&gt;
          &lt;/AddressName&gt;
        &lt;/xsl:for-each&gt;
      &lt;/root&gt;
    &lt;/xsl:template&gt;
  </code></pre>
  
  <p>My question is when instead of using a variable to contain current position and then use it to index a particular Item within collection of "//Item", I try only this </p>
  
  <pre><code>&lt;xsl:value-of select="$AddressNames//Item[position()]/names"/&gt;
  </code></pre>
  
  <p>I don't get the desired output...
  Desired output:</p>
  
  <pre><code>&lt;root&gt;
      &lt;AddressName&gt;rahul sharma&lt;/AddressName&gt;
      &lt;AddressName&gt;rahul sharma&lt;/AddressName&gt;
      &lt;AddressName&gt;rahul sharma1&lt;/AddressName&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Wrong output recieved:</p>
  
  <pre><code>&lt;root xmlns:myUtil="pda:MyUtils"&gt;
      &lt;AddressName&gt;rahul sharma&lt;/AddressName&gt;
      &lt;AddressName&gt;rahul sharma&lt;/AddressName&gt;
      &lt;AddressName&gt;rahul sharma&lt;/AddressName&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Input is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &lt;address&gt;
    &lt;item p2:type="ns1:sboeconnectCustomerAddressEntityItem" xmlns:p2="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;customer_address_id p2:type="xsd:string"&gt;19221&lt;/customer_address_id&gt;
      &lt;created_at p2:type="xsd:string"&gt;2015-01-21 13:11:13&lt;/created_at&gt;
      &lt;updated_at p2:type="xsd:string"&gt;2015-01-21 13:11:13&lt;/updated_at&gt;
      &lt;city p2:type="xsd:string"&gt;los angeles&lt;/city&gt;
      &lt;company p2:type="xsd:string"&gt;insync&lt;/company&gt;
      &lt;country_id p2:type="xsd:string"&gt;US&lt;/country_id&gt;
      &lt;firstname p2:type="xsd:string"&gt;rahul&lt;/firstname&gt;
      &lt;lastname p2:type="xsd:string"&gt;sharma&lt;/lastname&gt;
      &lt;postcode p2:type="xsd:string"&gt;90066&lt;/postcode&gt;
      &lt;region p2:type="xsd:string"&gt;Alabama@AL&lt;/region&gt;
      &lt;street p4:arrayType="xsd:string[1]" p2:type="ns1:ArrayOfString" xmlns:p4="http://schemas.xmlsoap.org/soap/encoding/"&gt;
        &lt;item p2:type="xsd:string"&gt;eeee&lt;/item&gt;
      &lt;/street&gt;
      &lt;telephone p2:type="xsd:string"&gt;8065534367&lt;/telephone&gt;
      &lt;is_default_billing p2:type="xsd:boolean"&gt;true&lt;/is_default_billing&gt;
      &lt;is_default_shipping p2:type="xsd:boolean"&gt;true&lt;/is_default_shipping&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;customer_address_id&gt;19221&lt;/customer_address_id&gt;
      &lt;city&gt;los angeles&lt;/city&gt;
      &lt;country_id&gt;US&lt;/country_id&gt;
      &lt;region&gt;Alabama@AL&lt;/region&gt;
      &lt;firstname&gt;rahul&lt;/firstname&gt;
      &lt;lastname&gt;sharma&lt;/lastname&gt;
      &lt;postcode&gt;90066&lt;/postcode&gt;
      &lt;street&gt;
        &lt;item p4:type="xsd:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"&gt;eeee&lt;/item&gt;
      &lt;/street&gt;
      &lt;telephone&gt;8065534367&lt;/telephone&gt;
      &lt;is_default_billing&gt;false&lt;/is_default_billing&gt;
      &lt;is_default_shipping&gt;true&lt;/is_default_shipping&gt;
    &lt;/item&gt;
    &lt;item p2:type="ns1:sboeconnectCustomerAddressEntityItem" xmlns:p2="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;customer_address_id p2:type="xsd:string"&gt;19222&lt;/customer_address_id&gt;
      &lt;created_at p2:type="xsd:string"&gt;2015-01-21 13:11:13&lt;/created_at&gt;
      &lt;updated_at p2:type="xsd:string"&gt;2015-01-21 13:11:13&lt;/updated_at&gt;
      &lt;city p2:type="xsd:string"&gt;los angeles&lt;/city&gt;
      &lt;company p2:type="xsd:string"&gt;insync&lt;/company&gt;
      &lt;country_id p2:type="xsd:string"&gt;US&lt;/country_id&gt;
      &lt;firstname p2:type="xsd:string"&gt;rahul&lt;/firstname&gt;
      &lt;lastname p2:type="xsd:string"&gt;sharma&lt;/lastname&gt;
      &lt;postcode p2:type="xsd:string"&gt;90066&lt;/postcode&gt;
      &lt;region p2:type="xsd:string"&gt;Alabama@AL&lt;/region&gt;
      &lt;street p4:arrayType="xsd:string[1]" p2:type="ns1:ArrayOfString" xmlns:p4="http://schemas.xmlsoap.org/soap/encoding/"&gt;
        &lt;item p2:type="xsd:string"&gt;CB-28&lt;/item&gt;
      &lt;/street&gt;
      &lt;telephone p2:type="xsd:string"&gt;8065534367&lt;/telephone&gt;
      &lt;is_default_billing p2:type="xsd:boolean"&gt;false&lt;/is_default_billing&gt;
      &lt;is_default_shipping p2:type="xsd:boolean"&gt;false&lt;/is_default_shipping&gt;
    &lt;/item&gt;
  &lt;/address&gt;
  </code></pre>
  
  <p>The variable (AddressNames) contains the following information:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;AddressNameCollection&gt;
    &lt;Item&gt;
      &lt;names&gt;rahul sharma&lt;/names&gt;
    &lt;/Item&gt;
    &lt;Item&gt;
      &lt;names&gt;rahul sharma&lt;/names&gt;
    &lt;/Item&gt;
    &lt;Item&gt;
      &lt;names&gt;rahul sharma1&lt;/names&gt;
    &lt;/Item&gt;
  &lt;/AddressNameCollection&gt;
  </code></pre>