<generator name='FlightStats Flight Status' xmlns='http://www.mozilla.org/microsummaries/0.1'>

  <pages>
    <include>^http://www\.flightstats\.com/go/FlightStatus/flightStatusByFlight\.do</include>
  </pages>

  <update interval='15'/>

  <template>
    <transform version='1.0' xmlns='http://www.w3.org/1999/XSL/Transform'>
      <output method='text'/>
      <template match='/'>

        <!-- Airline Code & Flight Number
           -
           - We get this from the header at the top of the page, which looks
           - like "Track Flight Status for @@ ####" (where @@ is the airline
           - code and #### is the flight number).  We use the substring-after
           - function to grab the part after "Track Flight Status for ".
           -
           -->
        <value-of select='normalize-space(substring-after(string(id(&apos;subheaderLabel&apos;)/h1), &apos;Track Flight Status for &apos;))'/>

        <text>: </text>

        <!-- Current Status
           -
           - This changes position in the table depending on the status
           - of the flight, so we select the row with a "Status:" cell.
           -
           -->
        <value-of select='normalize-space(string(id(&apos;resultsBlock&apos;)/table[1]/tbody/tr/td[1]/table/tbody/tr[normalize-space(td)=&apos;Status:&apos;]/td[3]))'/>

        <text>, </text>

        <!-- Estimated/Actual Arrival Time
           -
           - I start from the "Arrival" header and walk the tree to the table
           - cell containing the estimated or actual arrival date and time.
           - Then I extract the time portion from the date/time string.
           -
           - Since the string is a fixed place record (each portion is always
           - in the same place in the string, f.e. Fri - Feb 16, 2007 02:00 PM),
           - I can use the substring function to extract the time portion
           - by position in the string.
           -
           -->
        <value-of select='substring(normalize-space(//h2[contains(.,&apos;Arrival&apos;)]/../../following-sibling::tr[position()=4]/td[3]/b), 20)'/>

      </template>

    </transform>
  </template>

</generator>
