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

html table of sorted element names

Subject: html table of sorted element names
From: Saverio Perugini <sperugin@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2003 23:32:08 -0500 (EST)
html table sorted
Hello,

I'd like to produce a 4 column HTML table where the
text contained in each <td> element is alphabetically
sorted from cell (1,1) to cell (n,4),
where n is the required number of rows.

The following is an attempt:

<xsl:template match="/db">
   <xsl:if test="*[some condition]">
      <xsl:variable name="sortedelements">
         <xsl:for-each select="*">
            <xsl:sort data-type="text" select="name()"/>
            <xsl:copy-of select="."/>
         </xsl:for-each>
      </xsl:variable>

      <xsl:variable name="sortedelementsNodeSet"
                    select="exsl:node-set($sortedelements)/*"/>
      <table>
         <xsl:for-each select="$sortedelementsNodeSet[position() mod 4 = 1]">
            <tr>
               <xsl:for-each select=".|following-sibling::node()[position() &lt; 4]">
                   <td><xsl:value-of select="name()"/></td>
               </xsl:for-each>
            </tr>
         </xsl:for-each>
      </table>
   </xsl:if>
</xsl:template>

While this produces a table, not all rows contain four columns, and even
worse, the text contained in the <td>'s is not sorted across all <td>'s.

I am using libxslt, which supports the node-set() exslt function.
Does anyone see what is going wrong here?

Thanks,
Saverio

 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.