This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Q on <xsl:sort>


Looks like another case for the XSL Comic Strip
questor: I'm the gatekeeper into the beautiful city of Petra. I've managed
to get all arivals sorted into pairs of camels and donkeys by typing them
together. I'd like to sort all donkeys into descending age.
list (All): Use <sort to get them in the right order.
questor: I did that but now my camels are in the wrong order.
list (All): Ok so sort by the camels age.
questor: That didn't work so I took my scimitar and cut all the teathers.
Now they are all running round all jumbled up.
list: Now where is that stick?

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


>-----Original Message-----
>From: owner-xsl-list@lists.mulberrytech.com
>[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Walter Torres
>Sent: 02 May 2001 23:22
>To: xsl-list@lists.mulberrytech.com
>Subject: RE: [xsl] Q on <xsl:sort>
>
>
>> -----Original Message-----
>> From: owner-xsl-list@lists.mulberrytech.com
>> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
>> Clapham, Paul
>> Sent: Tuesday, May 01, 2001 3:34 PM
>> To: xsl-list@lists.mulberrytech.com
>> Subject: RE: [xsl] Q on <xsl:sort>
>>
>>
>> You told it to sort as if the data it was sorting was a
>> number.  So it takes '2001-04-16T04:30:32' and converts
>> it to a number; what does this give?
>> Probably NaN.  So since all the data items being sorted are
>> NaN, the sort has to fall back on document order, and since
>> you asked for descending, you get reverse document order.
>
>Thanks, I removed the data-type='number' attribute and ran it again.
>
>Same results.
>
>Any ideas.
>
>Walter
>
>
>
>
>>
>> PC2
>>
>> -----Original Message-----
>> From: Walter Torres [mailto:walter@torres.ws]
>> Sent: May 1, 2001 13:08
>> To: xsl-list@lists.mulberrytech.com
>> Subject: [xsl] Q on <xsl:sort>
>>
>>
>> I have this snippet... (see below)
>>
>>
>>
>> I have a four record sample set ( 1 record sample xml is below ).
>> Each record is different date/times.
>>
>> My problem is that this sort is not sorting on what I thought
>> it would.
>>
>> It should display...
>>   record 4
>>   record 1
>>   record 3
>>   record 2
>>
>> But it is...
>>   record 4
>>   record 3
>>   record 2
>>   record 1
>>
>> It looks like it is displaying in reverse xml order not
>> reverse timestamp
>> order.
>>
>> any ideas?
>>
>> Walter
>>
>>
>> ===========================================================
>>
>> <xsl:template match='callEvent/response/interaction_list'>
>>
>>    <xsl:apply-templates>
>>       <xsl:sort select='./interaction/timestamp'
>>                 order='descending'
>>                 data-type='number' />
>>    </xsl:apply-templates>
>>
>> </xsl:template>
>>
>> <!-- timestamp NODE Template -->
>> <xsl:template match="timestamp">
>>    <!-- Pull the pieces apart -->
>>    <xsl:variable name='datetime' select='.' />
>>    <xsl:variable name='year'  select='substring( $datetime, 0
>> , 5 )' />
>>    <xsl:variable name='month' select='substring( $datetime, 6
>> , 2 )' />
>>    <xsl:variable name='day'   select='substring( $datetime, 9
>> , 2 )' />
>>
>>    <td valign='top'>
>>       <!-- put the date together in American order -->
>>       <xsl:value-of select="concat($month, '/', $day, '/', $year )" />
>>       <!-- Seperate the date and Time -->
>>       -
>>       <!-- Display the Time -->
>>       <xsl:value-of select='substring( $datetime, 12 , 9 )' />
>>    </td>
>> </xsl:template>
>>
>> ===========================================================
>> -- sample record, 1 of 4 in my demo set --
>> -- the interaction NODE is repeated in this set --
>>
>> <callEvent>
>>    <response>
>>       <interaction_list>
>>          <interaction id='19766'>
>>             <timestamp
>> unix='987413416000'>2001-04-16T04:30:32</timestamp>
>>             <media_type id='103'>Phone</media_type>
>>             <channel id='1'>-</channel>
>>             <ani></ani>
>>             <dnis></dnis>
>>             <route_type>I</route_type>
>>             <events>
>>                <call_event id='34757'>
>>                   <timestamp
>> unix='987413416000'>2001-04-16T04:30:32</timestamp>
>>                   <call_event_type id='98'>eMail</call_event_type>
>>                   <customer id='2124'>Harris</customer>
>>                   <curr_dest id='103'>Vincent</curr_dest >
>>                   <to_dest id='1'>-</to_dest>
>>                   <nav_code id='1'>-</nav_code>
>>                   <rule id='1'>-</rule>
>>                   <greeting id='1'>-</greeting>
>>                   <call_type id='1'>-</call_type>
>>                   <ext_call id='1'>-</ext_call>
>>                   <old_call_record id='1'>-</old_call_record>
>>                   <product id='1'>-</product>
>>                   <reason id='198'>Case Resolution</reason>
>>                   <detailed_comment>Closed issue about bad
>> check</detailed_comment>
>>                </call_event>
>>             </events>
>>          </interaction>
>>       </interaction_list>
>>    </response>
>> </callEvent>
>>
>> =====================================
>>
>> eof
>>
>>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]