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

RE: Sorting and re-ordering down a hierarchy

Subject: RE: Sorting and re-ordering down a hierarchy
From: "Cole, Chris" <chris.cole@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Jul 2003 16:17:25 -0000
sorting hierarchy
Guten Tag Dave,
Thanks for your email. I think I have been trying to make my problem more
complicated than it actually was - I think David Carlisle has solved it for
me!

Guten Abend;-)
Chris

> -----Original Message-----
> From: David Ohlemacher [mailto:ohlemacher@xxxxxxx] 
> Sent: 18 July 2003 16:19
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Sorting and re-ordering down a hierarchy
> 
> 
> Hi Chris,
> 
> Sorry, I have no help. I tried to do this and failed.  I finally 
> reevaluated the tool (DAML/XSLT Adapter 
> <http://www.daml.org/tools/#damlxslt>) that generated my 
> self-referencing data, and tossed it.   I found Perl, 
> operating on the 
> DAML data directly, was SO much simpler.   Also the tool's author was 
> not helpful.
> 
> After a wasted week of learning XSL (it was a waste for me, no flames 
> please), it took me about 4 hours to write this in Perl.   
> The tool made 
> the work more difficult since it "introduced" the self 
> referencing.  The 
> DAML was simpler. 
> 
> Guten Tag,
> -d
> 
> Cole, Chris wrote:
> 
> >Hello,
> > I'm struggling to re-organise my node tree.
> > My tree is something like this:
> >
> ><input>
> ><node>
> >    <rank>2</rank>
> >    <node>
> >        <rank>88</rank>
> >    </node>
> >    <node>
> >        <rank>7</rank>
> >    </node>
> >    <node>
> >        <rank>66</rank>
> >    </node>
> ></node>
> ><node>
> >    <rank>1</rank>
> >    <node>
> >        <rank>3</rank>
> >    </node>
> >    <node>
> >        <rank>2</rank>
> >    </node>
> >    <node>
> >        <rank>1</rank>
> >    </node>
> ></node>
> ></input>
> >
> >I need to reorganise the nodes so that they are organised in number 
> >order down the nodes within their tree, so the output should be like 
> >this: <output> <node>
> >    <rank>1</rank>
> >    <node>
> >        <rank>7</rank>
> >    </node>
> >    <node>
> >        <rank>66</rank>
> >    </node>
> >    <node>
> >        <rank>88</rank>
> >    </node>
> ></node>
> ><node>
> >    <rank>2</rank>
> >    <node>
> >        <rank>1</rank>
> >    </node>
> >    <node>
> >        <rank>2</rank>
> >    </node>
> >    <node>
> >        <rank>3</rank>
> >    </node>
> ></node>
> ></output>
> >I can sort one level by using the code below, but I'm 
> struggling to find a
> >way to re-order the second level within the first level (and 
> the third level
> >later).
> >
> ><xsl:template match="/input">
> >  <xsl:call-template name="ascending-numeric-sort-l1">
> >    <xsl:with-param name="seqnuml1" select="node/rank"/>
> >  </xsl:call-template>
> >
> ></xsl:template>
> >
> ><xsl:template name="ascending-numeric-sort-l1">
> >  <xsl:param name="seqnuml1"/>
> >  <xsl:for-each select="$seqnuml1">
> >    <xsl:sort select="." data-type="number" order="ascending"/>
> >    <xsl:copy-of select="parent::node()"/>
> >  </xsl:for-each>
> ></xsl:template>
> >
> >Can anybody offer any advice please?
> >Thanks
> >Chris
> >
> > 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


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.