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

RE: sorting union results

Subject: RE: sorting union results
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Thu, 15 Aug 2002 13:40:38 -0400
sort union
Hey Doug,

It sorted for me, if I understood the intent correctly.

Here was my xml:
<glossary>
    <entry>
        <term>A term</term>
        <acronym>A acronym</acronym>
        <definition></definition>
    </entry>
    <entry>
        <term>C term</term>
        <acronym>C acronym</acronym>
        <definition></definition>
    </entry>
    <entry>
        <term>B term</term>
        <acronym>B acronym</acronym>
        <definition></definition>
    </entry>
</glossary>

Here was the output:
  <p>A acronym:</p> 
  <p>A term:</p> 
  <p>B acronym:</p> 
  <p>B term:</p> 
  <p>C acronym:</p> 
  <p>C term:</p> 

Is that not what you wanted?

If so, then maybe your problem is elsewhere in your stylesheet.  Is this RTF
being directly output'ed? Or, are you capturing this in an xsl:variable?

-Jeff

-----Original Message-----
From: Doug Howell [mailto:doug@xxxxxxxxxxxxxxxxxxxx]
Sent: Thursday, August 15, 2002 1:10 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  sorting union results


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

 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.