• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

XSL File

Hi,

I'm just trying to transform this source xml into a final output and it is working fine at the moment if every thing is ok. However, If we gets error in the response XML we need to counter for that as well so I have made the appropriate change but it is not quite displaying the correct output yet. I have attached the souce XML and the XSL file so can some body have look as to where I'm going wrong please.
AmericsDirectFareQuoteResponseSo.xml
XSLTFile1.xml
0
ube100
Asked:
ube100
  • 3
1 Solution
 
Geert BormansInformation ArchitectCommented:
you need to change this part
	<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:if test="(.//Errors/Error[@Code != ''])">
					<Error
						AnteeoReason="There was an error retrieving availability."
						ErrorCode="{.//Errors/Error/@Code}"
						ErrorText="{.//Errors/Error/@ShortText}"
						ErrorText2=""
						Code=""
						AppErrorSeverityLevel=""
						QuickIndicator="N"
					/>
				</xsl:if>

Open in new window

0
 
Geert BormansInformation ArchitectCommented:
"/Errors" gives you the Errors element that is the root, but <Errors> is not a root
this should be "//Errors"
or maybe ".//Errors", as I did, if you don't want to go from the root, it doesn't make a difference in this example

If what you show is the real XML,
I would go for "/OTA_HotelAvailRS/Errors/Error" as the path
different options, only /Errors is wrong

Your second error was in the predicates
ErrorText="{.//Errors/Error[@ShortText]}"
gives you the Error that has an attribute ShortText,
but you want that attribute, so you need
ErrorText="{.//Errors/Error/@ShortText}"
                              
0
 
ube100Author Commented:
That was very good lesson.

Thank you.
0
 
Geert BormansInformation ArchitectCommented:
welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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