Get nodes value one by one in xslt

Posted by Audy on Stack Overflow See other posts from Stack Overflow or by Audy
Published on 2013-10-26T09:50:39Z Indexed on 2013/10/26 9:53 UTC
Read the original article Hit count: 360

Filed under:

I am using XSl file in which I am reading values from xml node and creating another xml file. Following is the part of input xml from which I want to read value node one by one.

Input Xml:

<RoomsInvs>
        <RoomInv>
            <ProvisionalId Id="13-0000000007">13-0000000007</ProvisionalId>
        </RoomInv>
        <RoomInv>
            <ProvisionalId Id="13-0000000008">13-0000000008</ProvisionalId>
        </RoomInv>
    </RoomsInvs>

Xsl Applied:

 <values>
   <xsl:apply-templates select="//RoomsInvs/RoomInv" />
 </values>



<xsl:template match="RoomInv" >
<tempID>
  <xsl:value-of select="ProvisionalId[position()]"/>
</tempID>
</xsl:template>

Output Getting:

<values>
    <tempID>13-0000000007</tempID>
    <tempID>13-0000000007</tempID>
  </values>

Output I want:

<values>
 <tempID>13-0000000007</tempID>
 <tempID>13-0000000008</tempID>
</values>

© Stack Overflow or respective owner

Related posts about xslt