xsl-list
[Top] [All Lists]

Re: [xsl] populating table with sorted elements

2006-07-29 09:44:01
On 7/29/06, Christian Marc Schmidt <christianmarc(_at_)gmail(_dot_)com> wrote:
I am a newcomer to XML/XSLT and am struggling
with a bit of code in which I am attempting to populate
a six-column table, while allowing an xsl:sort.

Here is a section of my current code:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

...

<table width="970" border="0" cellspacing="0" cellpadding="0">
    <xsl:for-each select="xml/work/*[position() mod 6 = 1]">
        <tr>
            <xsl:apply-templates
select=".|following-sibling::*[position() &lt; 6]" />
        </tr>
    </xsl:for-each>
</table>

...

The XML structure I've set up looks like this:

<xml>
    <work>
        <piece>
        </piece>
         <piece>
        </piece>
        ...
    </work>
</xml>

How would I go about adding sort functionality? It seems like it would
be easy enough, yet all of my attempts so far have failed...

Any suggestions would be much appreciated!

<xsl:sort> can be a child of <xsl:apply-templates>, eg:

<xsl:apply-templates select="........">
 <xsl:sort select="....."/>
</xsl:apply-templates/>

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>