XSL coding problem: fetching information from a XML tree what loo k different every time.

Hi ! 
I have this problem with fetching information out of a XML-tree with XSL.
The tree could look like this: 
<flightinfo> 
     <ficomments>
        <flight>Finnair - AY 792</flight>
        <ficomment>
            <from>Malpensa (MXP), Milan, Italy</from>
            <to>-</to>
            <comment>DEPARTS TERMINAL 1</comment>
        </ficomment>
        <ficomment>
            <from>Arlanda (ARN), Stockholm, Sweden</from>
            <to>Helsinki-Vantaa (HEL), Helsinki, Finland</to>
            <comment>DEPARTS TERMINAL 2</comment>
        </ficomment>
        <ficomment>
            <from>-</from>
            <to>Helsinki-Vantaa (HEL), Helsinki, Finland</to>
            <comment>ARRIVES TERMINAL 2</comment>
        </ficomment>
        <ficomment>
            <from>Malpensa (MXP), Milan, Italy</from>
            <to>Arlanda (ARN), Stockholm, Sweden</to>
            <comment>ARRIVES TERMINAL 2</comment>
        </ficomment>
        <ficomment>
            <from>-</from>
            <to>-</to>
            <comment>9/ NON-SMOKING</comment>
        </ficomment>
    </ficomments>
</flightinfo> 

I want to fetch the first DEPARTS TERMINAL and the last ARRIVES TERMINAL in
the tree. The tree is different every time. There could be more <ficomment>
occurences before DEPARTS TERMINAL 1 
and after ARRIVES TERMINAL 2, so you cannot use a postion() argument. The
code that is used today is looking like below. The problem is that it
fetching all the DEPARTS TERMINALs and all the ARRIVES TERMINALs and I only
want the first and last: 
<xsl:template match="ficomments/ficomment" mode="departs">
	<xsl:if test="starts-with(comment,'DEPARTS')">
		<xsl:value-of select="comment"/><br/>
	</xsl:if>
</xsl:template>

Is there anyone that know how to solve this ? I've tried with
following-sibling and <xsl:sort select="comment" order="descending">(and
writing a xsl:value-of select="comment[1]"/><br/>) but nothing works. 

Peter Landhage, Telelogic Sverige AB
Amadeus - WTM Competence Center
Tel: +46-(0)703-401481
peter.landhage@era.ericsson.se

Received on Tuesday, 21 November 2000 02:33:15 UTC