[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: sorting question

Subject: RE: sorting question
From: "Oliver Rutherfurd" <fruhstuck@xxxxxxxxxxxxxx>
Date: Wed, 7 Mar 2001 08:26:34 -0500
sorting question
Hmm, I see what you mean about efficiency...  Well, it's nice to know it can
be done, and how to do it ;-).  Thanks much for the information.

-Ollie

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Diamond,
> Jason
> Sent: Wednesday, March 07, 2001 8:01 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  sorting question
>
>
> That certainly complicates things. But it is still possible using XSLT
> 1.0--although it's certainly not efficient.
>
> <xsl:transform version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>   <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
>
>   <xsl:template match="ALPHABET">
>     <xsl:for-each select="LETTER">
>       <xsl:sort select="."/>
>       <xsl:if test="position() mod 2 = 1">
>         <tr>
>           <td>
>             <xsl:value-of select="."/>
>           </td>
>           <xsl:variable name="next" select="position() + 1"/>
>           <xsl:for-each select="../LETTER">
>             <xsl:sort select="."/>
>             <xsl:if test="position() = $next">
>               <td>
>                 <xsl:value-of select="."/>
>               </td>
>             </xsl:if>
>           </xsl:for-each>
>         </tr>
>       </xsl:if>
>     </xsl:for-each>
>   </xsl:template>
>
> </xsl:transform>
>
> We're basically iterating over the sorted list and then grabbing the next
> element in the sorted list by iterating over the same list
> _again_ but only
> outputting when we're at the position we want. Would this be O(n*n!)?
>
> What would be really nice would be a following-node axis (along with a
> corresponding preceding-node). This would help select the following or
> preceding nodes in the current node list (as constructed by
> <xsl:apply-templates> or <xsl:for-each>). This would obviously be specific
> to XSLT since XPath doesn't have any notion of a current node
> list. This use
> case seems like a good justification for those axis specifiers, though.
>
> Does anybody know if there is anything planned for XSLT 2.0 that
> might make
> this easier?
>
> Jason.

[snip...]


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.