0
<FlightPlan xmlns="http://aeec.aviation-ia.net/633" xmlns:extd="http://www.w3.org/2001/A633AIRBUSExtensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" category="normal" computedTime="2016-04-27T22:56:26" flightPlanId="OFP1" xsi:schemaLocation="http://aeec.aviation-ia.net/633 FlightPlan.xsd">
<M633Header timestamp="2016-04-27T22:57:05Z" versionNumber="2"/>
<M633SupplementaryHeader>
    <Flight flightOriginDate="2016-04-28" scheduledTimeOfDeparture="2016-04-28T04:55:00Z">
        <FlightIdentification>
            <FlightIdentifier>EZY8751</FlightIdentifier>
            <FlightNumber airlineIATACode="U2" number="8751">
                <CommercialFlightNumber>U28751</CommercialFlightNumber>
            </FlightNumber>
        </FlightIdentification>
        <DepartureAirport airportFunction="DepartureAirport" airportName="LONDON/GATWICK">
            <AirportICAOCode>EGKK</AirportICAOCode>
            <AirportIATACode>LGW</AirportIATACode>
        </DepartureAirport>
        <ArrivalAirport airportFunction="ArrivalAirport" airportName="KERKIRA/IOANNIS KAPODISTRIAS">
            <AirportICAOCode>LGKR</AirportICAOCode>
            <AirportIATACode>CFU</AirportIATACode>
        </ArrivalAirport>
    </Flight>
    <Aircraft aircraftRegistration="GEZWY">
        <AircraftModel airlineSpecificSubType="A320-CFM56-5B4/3-TI(SH) - MSN6267">
            <AircraftICAOType>A320</AircraftICAOType>
        </AircraftModel>
    </Aircraft>
</M633SupplementaryHeader>

I have following xml. Output should look like:

FlightIdentifier|FlightOriginDate|AircraftRegistration
EZY8751|20160428|GEZWY

I have tried this way, but it did not generate any output

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="text"/>

<xsl:template match="/">
    <xsl:apply-templates select="/FlightPlan/M633SupplementaryHeader/FlightIdentifier"/>


</xsl:template>
<!-- replace xsi:schemaLocation attribute -->
<xsl:template match="@xsi:schemaLocation">
    <xsl:attribute name="xsi:schemaLocation"></xsl:attribute>
</xsl:template>

3

1 Answer 1

1

You can use this XSL:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:aeec="http://aeec.aviation-ia.net/633"
exclude-result-prefixes="aeec">
  <xsl:output method="text"/>

  <xsl:template match="/">
    FlightIdentifier: <xsl:value-of select="aeec:FlightPlan/aeec:M633SupplementaryHeader/aeec:Flight/aeec:FlightIdentification/aeec:FlightIdentifier"/>
    FlightOriginDate: <xsl:value-of select="aeec:FlightPlan/aeec:M633SupplementaryHeader/aeec:Flight/@flightOriginDate"/>
    AircraftRegistration: <xsl:value-of select="aeec:FlightPlan/aeec:M633SupplementaryHeader/aeec:Aircraft/@aircraftRegistration"/>
  </xsl:template>

</xsl:stylesheet>

Online output: http://xsltransform.net/6rewNxL

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.