[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] html table of sorted element names
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() < 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|