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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • 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 BormansCommented:
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 BormansCommented:
"/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 BormansCommented:
welcome
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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