[xsl] sorting union results

Subject: [xsl] sorting union results
From: Doug Howell <doug@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Aug 2002 13:09:49 -0400
Hi, all, Given a structure like this:

<glossary>
    <entry>
        <term></term>
        <acronym></acronym>
        <definition></definition>
    </entry>
</glossary>

I'd like my stylesheet to create a list of glossary terms, inserting the
acronyms (as if they were terms) where they fit alphabetically in the list.
I'd like to avoid having to create another entry for each acronym and keep
the XML document smaller.)

I tried this:

<xsl:for-each select="//term|//acronym">
    <xsl:sort select="." order="ascending"/>
        <p><xsl:value-of select="."/>:</p>
</xsl:for-each>

This lists the terms and acronyms together, but doesn't sort them (they come
out in document order). I think I've read that the union operator can only
deliver the selected nodes in document order.

Is there any workaround to do what I want to do without creating an
intermediary document?

Thanks!

Doug Howell
Information Architect
Borders Group Inc.



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


Current Thread