sorting nodes in reverse document order

Subject: sorting nodes in reverse document order
From: Ann Marie Rubin - Sun PC Networking Engineering <Annmarie.Rubin@xxxxxxxxxxxx>
Date: Mon, 15 May 2000 10:23:03 -0400 (EDT)
Hello,

I'm stuck on this problem and hope someone on this list has some ideas
to get me going in the right direction.

I have a for-each statement inside a template that outputs a list of the
ancestors of the current context node. I couldn't use the parent or
ancestor axes to get this list because these nodes are not contained
within their parent nodes in the XML source document.  Each node has a
SUPERCLASS attribute whose value is the name of its parent.

Here is the XSL stylesheet code:

<!-- named template to do the hierarchy tracing -->
<xsl:template name="hierarchy">
<br data="{@NAME} -- {@SUPERCLASS}"><a href="{@NAME}.html"><xsl:value-of
select="@NAME"/></a></br>
<xsl:if test="@SUPERCLASS">
  <xsl:param name="parentname" select="@SUPERCLASS"/>
  <xsl:for-each select="//CLASS[@NAME=$parentname]">
       <xsl:call-template name="hierarchy"/>
  </xsl:for-each>
</xsl:if>
</xsl:template>

The nodes are output in this order:

context node
parent of context node
grandparent of context node
.
.
.
root node

How can I sort these nodes and output them in reverse order? For
example:

root node
.
.
.
grandparent of context node
parent of context node
context node


Thanks,

Ann Marie








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


Current Thread