[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

one more XSL

Hi,

I got this XSL half constructed and this should produce the output xml which I have attached. I have included all the XSL, source XML and the output XML this should produce. Can some one help on this please!!
HotelAvailabilityResponseResult.xml
HotelAvailabilityResponseSource.xml
HotelAvailabilityXSL.xml
0
ube100
Asked:
ube100
  • 2
1 Solution
 
Geert BormansCommented:
Here you go,
if you want each RoomStay to be an AvailHtl,
then you need to remove the "[1]"
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
    xmlns:ota="http://www.opentravel.org/OTA/2003/05" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output indent="yes"/>
	<xsl:strip-space elements="*"/>
	<xsl:param name="service" select="''" />
	<xsl:param name="trans" select="''" />
	<xsl:output method="xml" omit-xml-declaration="yes"/>
	<xsl:template match="/">
		<Anteeo>
			<table name="STATUS" service="{$service}">
				<!-- All error records should follow this format. If they don't change the format for  
                                all error messages. -->
				<xsl:choose>
					<xsl:when test="(.//Errors/Error[@Code != ''])">
						<Error  
								AnteeoReason="There was an error retrieving availability."  
								ErrorCode="{.//ota:Errors/ota:Error/@Code}"  
								ErrorText="{.//ota:Errors/ota:Error/@ShortText}"  
								ErrorText2=""  
								Code=""  
								AppErrorSeverityLevel=""  
								QuickIndicator="N"  
                                                />
					</xsl:when>
					<xsl:when test="(.//Errors/Error[@Code = '']) | .//ota:Success">
						<Error  
								AnteeoReason="All OK."  
								ErrorCode=""  
								ErrorText=""  
								ErrorText2=""  
								Code=""  
								AppErrorSeverityLevel=""  
								QuickIndicator="Y"  
                                                />
					</xsl:when>
				</xsl:choose>
			</table>
			<table name="HotelAvail" service=''>
				<xsl:apply-templates select=".//ota:OTA_HotelAvailRS/ota:RoomStays/ota:RoomStay[1]"/>
			</table>
		</Anteeo>
	</xsl:template>
	<xsl:template match="ota:RoomStay">
		<AvailHtl RatePlanCode="{ota:RoomRates/ota:RoomRate/@RatePlanCode}" Duration="{ota:TimeSpan/@Duration}" Start="{ota:TimeSpan/@Start}" HotelCodeContext="{ota:BasicPropertyInfo/@HotelCodeContext}" AmountAfterTax="{ota:Total/@AmountAfterTax}" CurrencyCode="{ota:Total/@CurrencyCode}" RPH="{ota:ResGuestRPHs/ota:ResGuestRPH/@RPH}" OffsetUnitMultiplier="{ota:CancelPenalties/ota:CancelPenalty/ota:Deadline/@OffsetUnitMultiplier}"/>		
	</xsl:template>
</xsl:stylesheet>

Open in new window

0
 
ube100Author Commented:
Thanks!
0
 
Geert BormansCommented:
welcome
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now