i have an xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="*|text()" />
<xsl:key name="room-per-hotel" match="result" use="concat(AccommodationId,'-', RoomId)" />
<xsl:variable name="doc2" select="."/>
<xsl:template match="/">
<xsl:for-each select="$doc2/Success/result">
<xsl:if test="position() = 1">
<RuleMessage>
<xsl:attribute name="HotelCode">
<xsl:value-of select="AccommodationId"/>
</xsl:attribute>
<xsl:for-each select="$doc2/Success/result[count(. | key('room-per-hotel', concat(AccommodationIdAccommodationId,'-', RoomId))[1]) = 1]">
<xsl:sort select="concat(AccommodationId,'-', RoomId)" />
<xsl:variable name="doc1" select="."/>
<xsl:element name="StatusApplication">
<xsl:attribute name="RatePlanCode">
<xsl:value-of select="RoomIdRatePlanIdCode"/>
</xsl:attribute>
<xsl:attribute name="InvTypeCode">
<xsl:value-of select="RoomId"/>
</xsl:attribute>
<xsl:attribute name="RatePlanCategory">
<xsl:value-of select='"BB"'/>
</xsl:attribute>
</xsl:element>
<BookingRules>
<xsl:for-each select="$doc1/StartDate/tokenize(.,',')">
<xsl:variable name="pos" select="position()"/>
<xsl:if test="$doc1/OpenClose/tokenize(.,',')[position()=$pos] !='' ">
<xsl:element name="BookingRule">
<xsl:attribute name="Start" >
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:attribute name="End" >
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:element name="RestrictionStatus">
<xsl:attribute name="Restriction">
<xsl:value-of select='"Master"'/>
</xsl:attribute>
<xsl:attribute name="Status" >
<xsl:value-of select="$doc1/OpenClose/tokenize(.,',')[position()=$pos]"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:for-each>
</BookingRules>
</xsl:for-each>
</RuleMessage>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
which is producing the result as below
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<OTA_HotelBookingRuleRS xmlns="http://vbookings.bookingwhizz.com/connectAPI.asmx">
<RuleMessage HotelCode="5" xmlns="">
<StatusApplication RatePlanCode="101739608_1" InvTypeCode="101739608" RatePlanCategory="BB"/>
<BookingRules>
<BookingRule Start="2015-07-15" End="2015-07-15">
<LengthsOfStay>
<LengthOfStay MinMaxMessageType="SetMinLOS" TimeUnit="Day" Time="1"/>
</LengthsOfStay>
</BookingRule>
</BookingRules>
<StatusApplication RatePlanCode="101739608_2" InvTypeCode="101739608" RatePlanCategory="BB"/>
<BookingRules>
<BookingRule Start="2015-07-15" End="2015-07-15">
<LengthsOfStay>
<LengthOfStay MinMaxMessageType="SetMinLOS" TimeUnit="Day" Time="2"/>
</LengthsOfStay>
</BookingRule>
</BookingRules>
</RuleMessage>
</OTA_HotelBookingRuleRS>
</soap:Body>
</soap:Envelope>
but i need the result as below
="1.0"="utf-8"
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<OTA_HotelBookingRuleRS xmlns="http://vbookings.bookingwhizz.com/connectAPI.asmx">
<RuleMessage HotelCode="5" xmlns="">
<StatusApplication RatePlanCode="101739608_1" InvTypeCode="101739608" RatePlanCategory="BB" />
<BookingRules>
<BookingRule Start="2015-07-14" End="2015-07-14">
<RestrictionStatus Restriction="Master" Status="Close" />
</BookingRule>
</BookingRules>
</RuleMessage>
<RuleMessage HotelCode="5" xmlns="">
<StatusApplication RatePlanCode="101739608_2" InvTypeCode="101739608" RatePlanCategory="BB" />
<BookingRules>
<BookingRule Start="2015-07-14" End="2015-07-14">
<RestrictionStatus Restriction="Master" Status="Close" />
</BookingRule>
</BookingRules>
</RuleMessage>
....
</OTA_HotelBookingRuleRS>
</soap:Body>
</soap:Envelope>