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(_at_)bbn(_dot_)com]
Sent: 18 July 2003 16:19
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] 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