ube100
asked on
processing xml document from VB application.
Hi,
Have a look at this xml:
<?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}">
</table>
<xsl:apply-templates select=".//ota:OTA_HotelAv ailRS/ota: RoomStays" />
</Anteeo>
</xsl:template>
<xsl:template match="ota:Errors">
<Error
AnteeoReason="There was an error retrieving availability."
ErrorCode="{/Error/Code}"
ErrorText="{//Error/ShortT ext}"
ErrorText2=""
Code="{/Error/Code}"
AppErrorSeverityLevel=""
QuickIndicator="N"
/>
</xsl:template>
<xsl:template match="message">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="alternatelistseg">
<table name="HotelAvail" service="{$service}">
<xsl:apply-templates />
</table>
</xsl:template>
<!-- <xsl:template match="/">
<xsl:apply-templates select="ota:OTA_HotelAvail RS/ota:Roo mStays"/>
</xsl:template>
-->
<xsl:template match="ota:RoomStays">
<table name="HotelAvail" service="">
<xsl:apply-templates select="ota:RoomStay"/>
</table>
</xsl:template>
<xsl:template match="ota:RoomStay">
<xsl:element name="AvailHtl">
<xsl:apply-templates select="*"/>
</xsl:element>
</xsl:template>
<xsl:template match="ota:TimeSpan">
<xsl:attribute name="TimeStart">
<xsl:value-of select="@Start"/>
</xsl:attribute>
<xsl:attribute name="TimeDuration">
<xsl:value-of select="@Duration"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="ota:Total">
<xsl:attribute name="AmountAfterTax">
<xsl:value-of select="@AmountAfterTax"/>
</xsl:attribute>
<!-- 09/12/2009 <xsl:attribute name="TimeDuration">
<xsl:value-of select="@Duration"/>
</xsl:attribute> -->
</xsl:template>
<xsl:template match="ota:ResGuestRPHs">
<xsl:for-each select="ota:ResGuestRPH">
<xsl:attribute name="ResGuestRPH-{positio n()}">
<xsl:value-of select="@RPH"/>
</xsl:attribute>
</xsl:for-each>
</xsl:template>
<xsl:template match="ota:RoomRates">
<xsl:for-each select="ota:RoomRate">
<xsl:attribute name="RoomRate-{position() }">
<xsl:value-of select="@RatePlanCode"/>
</xsl:attribute>
</xsl:for-each>
</xsl:template>
<xsl:template match="ota:BasicPropertyIn fo">
<xsl:attribute name="ID">
<xsl:value-of select="@HotelCodeContext" />
</xsl:attribute>
<xsl:attribute name="VendorMessage">
<xsl:value-of select="ota:VendorMessages "/>
</xsl:attribute>
</xsl:template>
<xsl:template match="ota:CancelPenalties ">
<xsl:for-each select="ota:CancelPenalty" >
<xsl:attribute name="CancelPenalty-{posit ion()}">
<xsl:value-of select="ota:Deadline/@Offs etUnitMult iplier"/>
</xsl:attribute>
</xsl:for-each>
</xsl:template>
<xsl:template match="ota:RoomStay">
<xsl:element name="AvailHtl">
<xsl:attribute name="MaxOccupancy"></xsl: attribute>
<xsl:attribute name="Minoccupancy"></xsl: attribute>
<xsl:apply-templates select="*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I need to process this xml file from a VB application. First of all, I need to check the error status and if no error and continue to process the xml. Can some body show me how can I achieve this VB6 please.
Have a look at this xml:
<?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}">
</table>
<xsl:apply-templates select=".//ota:OTA_HotelAv
</Anteeo>
</xsl:template>
<xsl:template match="ota:Errors">
<Error
AnteeoReason="There was an error retrieving availability."
ErrorCode="{/Error/Code}"
ErrorText="{//Error/ShortT
ErrorText2=""
Code="{/Error/Code}"
AppErrorSeverityLevel=""
QuickIndicator="N"
/>
</xsl:template>
<xsl:template match="message">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="alternatelistseg">
<table name="HotelAvail" service="{$service}">
<xsl:apply-templates />
</table>
</xsl:template>
<!-- <xsl:template match="/">
<xsl:apply-templates select="ota:OTA_HotelAvail
</xsl:template>
-->
<xsl:template match="ota:RoomStays">
<table name="HotelAvail" service="">
<xsl:apply-templates select="ota:RoomStay"/>
</table>
</xsl:template>
<xsl:template match="ota:RoomStay">
<xsl:element name="AvailHtl">
<xsl:apply-templates select="*"/>
</xsl:element>
</xsl:template>
<xsl:template match="ota:TimeSpan">
<xsl:attribute name="TimeStart">
<xsl:value-of select="@Start"/>
</xsl:attribute>
<xsl:attribute name="TimeDuration">
<xsl:value-of select="@Duration"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="ota:Total">
<xsl:attribute name="AmountAfterTax">
<xsl:value-of select="@AmountAfterTax"/>
</xsl:attribute>
<!-- 09/12/2009 <xsl:attribute name="TimeDuration">
<xsl:value-of select="@Duration"/>
</xsl:attribute> -->
</xsl:template>
<xsl:template match="ota:ResGuestRPHs">
<xsl:for-each select="ota:ResGuestRPH">
<xsl:attribute name="ResGuestRPH-{positio
<xsl:value-of select="@RPH"/>
</xsl:attribute>
</xsl:for-each>
</xsl:template>
<xsl:template match="ota:RoomRates">
<xsl:for-each select="ota:RoomRate">
<xsl:attribute name="RoomRate-{position()
<xsl:value-of select="@RatePlanCode"/>
</xsl:attribute>
</xsl:for-each>
</xsl:template>
<xsl:template match="ota:BasicPropertyIn
<xsl:attribute name="ID">
<xsl:value-of select="@HotelCodeContext"
</xsl:attribute>
<xsl:attribute name="VendorMessage">
<xsl:value-of select="ota:VendorMessages
</xsl:attribute>
</xsl:template>
<xsl:template match="ota:CancelPenalties
<xsl:for-each select="ota:CancelPenalty"
<xsl:attribute name="CancelPenalty-{posit
<xsl:value-of select="ota:Deadline/@Offs
</xsl:attribute>
</xsl:for-each>
</xsl:template>
<xsl:template match="ota:RoomStay">
<xsl:element name="AvailHtl">
<xsl:attribute name="MaxOccupancy"></xsl:
<xsl:attribute name="Minoccupancy"></xsl:
<xsl:apply-templates select="*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I need to process this xml file from a VB application. First of all, I need to check the error status and if no error and continue to process the xml. Can some body show me how can I achieve this VB6 please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.