XSL File

Posted on 2009-12-20
Last Modified: 2013-11-18

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.
Question by:ube100
    LVL 60

    Expert Comment

    by:Geert Bormans
    you need to change this part
    	<xsl:template match="/">
    			<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 != ''])">
    						AnteeoReason="There was an error retrieving availability."

    Open in new window

    LVL 60

    Accepted Solution

    "/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
    gives you the Error that has an attribute ShortText,
    but you want that attribute, so you need

    Author Closing Comment

    That was very good lesson.

    Thank you.
    LVL 60

    Expert Comment

    by:Geert Bormans

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now