I am having an xml file with some flights information.using xsl,i want to display airline ticket.
i want to display flight information in the form of a ticket.
the airline ticket should look like:
frankfurt UL 0554 22.11 18.00 22.11 23.59
Columbo UL 0553 06.12 20.00 06.12 23.59
franfurt
-VOID-
-VOID-
But i am getting output as
frankfurt UL 0554 22.11 18.00 22.11 23.59
Columbo UL 0553 06.12 20.00 06.12 23.59
each row is a salesorderserviceitem in my xml file.
for ex,if i am going from frankfurt to columbo and back,then my ticket looks as
frankfurt UL 0554 22.11 18.00 22.11 23.59
Columbo UL 0553 06.12 20.00 06.12 23.59
frankfurt
-VOID-
-VOID-
i mean i have to check whether any stops in bettween my source and destination.
if there are stops in between suppose frankfurt-singapore-columb
o and back then.
then i am expecting outout as:
(departure)(airlinecode)(f
lightnumbe
r)(dep date)(dep time) (arrivaldate)(arrivaltime)
frankfurt UL 0554 22.11 18.00 22.11 23.59
singapore UL 0553 06.12 20.00 06.12 23.59
columbo UL 0556 07.12 20.00 07.12 23.59
singapore UL 0551 08.12 20.00 08.12 23.59
frankfurt
i the above ticket,each row is an salesorderservice item.
i think i have to change the logic in only with <xsl:for-each> line in my xsl file.
Thanks for your help.
vihar123
--------------------------
----------
my xml file:
<?xml version="1.0" encoding="utf-16"?>
<SalesOrder Date="2003-08-11">
<Services>
<SalesOrderService>
<ServiceItems>
<SalesOrderServiceItem DateFrom="2003-11-22" DateUntil="2003-11-22">
<Unit>
<UnitDetails AirlineCode="UL" FlightNumber="0554" Direction="Outbound" DepartureTime="18.00" ArrivalTime="23:59" AddDays="0">
<DepartureAirport Code="FRA" Name="Frankfurt" City="" Country="" ID="606">
<Locations/>
</DepartureAirport>
<ArrivalAirport Code="CMB" Name="Colombo" City="" Country="" ID="568">
<Locations/>
</ArrivalAirport>
</UnitDetails>
</Unit>
</SalesOrderServiceItem>
<SalesOrderServiceItem DateFrom="2003-12-06" DateUntil="2003-12-06">
<Unit>
<UnitDetails AirlineCode="UL" FlightNumber="0553" Direction="Return" DepartureTime="20.00" ArrivalTime="23:59" AddDays="0">
<DepartureAirport Code="CMB" Name="Colombo" City="" Country="" ID="568">
<Locations/>
<Annotation>
<TranslatableText Language="EN"/>
</Annotation>
<Description>
<TranslatableText Language="EN"/>
</Description>
</DepartureAirport>
<ArrivalAirport Code="FRA" Name="Frankfurt" City="" Country="" ID="606">
<Locations/>
</ArrivalAirport>
</UnitDetails>
</Unit>
</SalesOrderServiceItem>
</ServiceItems>
</SalesOrderService>
<SalesOrderService>
<ServiceItems>
<SalesOrderServiceItem>
<Unit>
<UnitDetails nil="true"/>
</Unit>
</SalesOrderServiceItem>
<SalesOrderServiceItem>
<Unit>
<UnitDetails nil="true"/>
</Unit>
</SalesOrderServiceItem>
<SalesOrderServiceItem>
<Unit>
<UnitDetails nil="true"/>
</Unit>
</SalesOrderServiceItem>
</ServiceItems>
</SalesOrderService>
<SalesOrderService>
<ServiceItems>
<SalesOrderServiceItem>
<Unit>
<UnitDetails nil="true"/>
</Unit>
</SalesOrderServiceItem>
</ServiceItems>
</SalesOrderService>
</Services>
</SalesOrder>
--------------------------
-
my xsl file:
<?xml version="1.0" encoding="UTF-16" ?>
<xsl:stylesheet version="1.0"
xmlns:fo="
http://www.w3.org/1999/XSL/Format"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-micr
osoft-com:
xslt">
<xsl:template name="ticket_body">
<fo:table width="18cm">
<fo:table-column column-width="13cm"/>
<fo:table-column column-width="5cm"/>
<fo:table-body>
<fo:table-row height="3cm">
<fo:table-cell>
<fo:block>
<fo:table width="13cm">
<fo:table-column column-width="4.8cm"/>
<fo:table-column column-width="1cm"/>
<fo:table-column column-width="1cm"/>
<fo:table-column column-width="0.7cm"/>
<fo:table-column column-width="1.2cm"/>
<fo:table-column column-width="1.2cm"/>
<fo:table-column column-width="1cm"/>
<fo:table-column column-width="0.5cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="1.2cm"/>
<fo:table-column column-width="1.2cm"/>
<fo:table-column column-width="1.2cm"/>
<fo:table-body>
<fo:table-row height="0.5cm">
<fo:table-cell/>
</fo:table-row>
<xsl:for-each select="/SalesOrder/Servic
es/SalesOr
derService
/ServiceIt
ems/SalesO
rderServic
eItem">
<fo:table-row height="0.5cm">
<fo:table-cell>
<fo:block>
<xsl:value-of select="Unit/UnitDetails/D
epartureAi
rport/@Nam
e"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="Unit/UnitDetails/@
AirlineCod
e"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="Unit/UnitDetails/@
FlightNumb
er"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:if test="Unit/UnitDetails/Dep
artureAirp
ort/@Name !=''">
Y<!--xsl:value-of select="Unit/UnitDetails/@
Class"/-->
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:if test="Unit/UnitDetails/Dep
artureAirp
ort/@Name !=''">
<xsl:value-of select="substring(@DateFro
m,9,2)"/>.
<xsl:value
-of select="substring(@DateFro
m,6,2)"/>
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="Unit/UnitDetails/@
DepartureT
ime"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:if test="Unit/UnitDetails/Dep
artureAirp
ort/@Name !=''">
OK<!--xsl:value-of select="Unit/UnitDetails/@
Status"/--
>
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:if test="Unit/UnitDetails/Dep
artureAirp
ort/@Name !=''">
[N]
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:if test="Unit/UnitDetails/Dep
artureAirp
ort/@Name !=''">
<xsl:value-of select="substring(@DateUnt
il,9,2)"/>
.<xsl:valu
e-of select="substring(@DateUnt
il,6,2)"/>
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="Unit/UnitDetails/@
ArrivalTim
e"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:if test="Unit/UnitDetails/Dep
artureAirp
ort/@Name !=''">
12<!--for weight-->
</xsl:if>
</fo:block>
</fo:table-cell>
</fo:table-row>
<!--/xsl:for-each-->
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:template>
</xsl:stylesheet>