xml ノードから値を読み取り、別の xml ファイルを作成する XSl ファイルを使用しています。以下は、値ノードを1つずつ読み取りたい入力xmlの一部です。
入力 XML:
<Param>
<RoomsInvs>
<RoomInv>
<ProvisionalId Id="13-0000000007">13-0000000007</ProvisionalId>
</RoomInv>
<RoomInv>
<ProvisionalId Id="13-0000000008">13-0000000008</ProvisionalId>
</RoomInv>
</RoomsInvs>
<Rooms>
<Room NumberOfRooms="1" RoomId="TLC13-000005" Description="AC DEULEX" Twin="no" SupplierCode="RM" SupplierId="0" PropertyId="" ExtraBed="0" RateBasis="-4" Type="" Index="0">
<Rate Id="0" Currency="INR" Gross="4990.00" DisplayCurrency="INR" DisplayGross="4990.00" Net="4990.00" Tax="0" STax="" ExtraGuestCharge="0" AdultCount="2" AdultRate="1490.00" ChildCount="0" ChildRate=".00" Description="" Status="Available" AllocationDetails="-" SDisc="" SComm="" SRoomTotal="">
ieiorkmbjfgngjofmgfoikmfhkjg
</Rate>
</Room>
<Room NumberOfRooms="2" RoomId="TLC13-000005" Description="AC DEULEX" Twin="no" SupplierCode="RM" SupplierId="0" PropertyId="" ExtraBed="0" RateBasis="-4" Type="" Index="0">
<Rate Id="0" Currency="INR" Gross="4990.00" DisplayCurrency="INR" DisplayGross="4990.00" Net="4990.00" Tax="0" STax="" ExtraGuestCharge="0" AdultCount="2" AdultRate="1490.00" ChildCount="0" ChildRate=".00" Description="" Status="Available" AllocationDetails="-" SDisc="" SComm="" SRoomTotal="">
dbfbjsdbfjsdfbkjsdfbklnlnlsdf
</Rate>
</Room>
</Rooms>
<Param>
Xsl 適用:
<Rooms>
<xsl:apply-templates select="//Rooms/Room" >
<xsl:with-param name ="IdNo" select ="//RoomsInvs/RoomInv"></xsl:with-param>
</xsl:apply-templates>
</Rooms>
<xsl:template match="Room" >
<xsl:param name="IdNo"/>
<Room>
<tempID>
<xsl:value-of select="$IdNo[position()]/ProvisionalId"/>
</tempID>
<xsl:copy-of select="Rate"/>
</Room>
出力取得:
<Rooms>
<Room>
<tempID>13-0000000007</tempID>
<Rate Id="0" Currency="INR" Gross="4990.00" DisplayCurrency="INR" DisplayGross="4990.00" Net="4990.00" Tax="0" STax="" ExtraGuestCharge="0" AdultCount="2" AdultRate="1490.00" ChildCount="0" ChildRate=".00" Description="" Status="Available" AllocationDetails="-" SDisc="" SComm="" SRoomTotal="">
ieiorkmbjfgngjofmgfoikmfhkjg
</Rate>
</Room>
<Room>
<tempID>13-0000000007</tempID>
<Rate Id="0" Currency="INR" Gross="4990.00" DisplayCurrency="INR" DisplayGross="4990.00" Net="4990.00" Tax="0" STax="" ExtraGuestCharge="0" AdultCount="2" AdultRate="1490.00" ChildCount="0" ChildRate=".00" Description="" Status="Available" AllocationDetails="-" SDisc="" SComm="" SRoomTotal="">
dbfbjsdbfjsdfbkjsdfbklnlnlsdf
</Rate>
</Room>
</Rooms>
私が欲しい出力:
<Rooms>
<Room>
<tempID>13-0000000007</tempID>
<Rate Id="0" Currency="INR" Gross="4990.00" DisplayCurrency="INR" DisplayGross="4990.00" Net="4990.00" Tax="0" STax="" ExtraGuestCharge="0" AdultCount="2" AdultRate="1490.00" ChildCount="0" ChildRate=".00" Description="" Status="Available" AllocationDetails="-" SDisc="" SComm="" SRoomTotal="">
ieiorkmbjfgngjofmgfoikmfhkjg
</Rate>
</Room>
<Room>
<tempID>13-0000000008</tempID>
<Rate Id="0" Currency="INR" Gross="4990.00" DisplayCurrency="INR" DisplayGross="4990.00" Net="4990.00" Tax="0" STax="" ExtraGuestCharge="0" AdultCount="2" AdultRate="1490.00" ChildCount="0" ChildRate=".00" Description="" Status="Available" AllocationDetails="-" SDisc="" SComm="" SRoomTotal="">
dbfbjsdbfjsdfbkjsdfbklnlnlsdf
</Rate>
</Room>
</Rooms>