xsl-list
[Top] [All Lists]

[xsl] Output sorted XHTML table for a subset of elements

2008-05-24 07:46:31
Hi,

I've been having a problem with a stylesheet I'm creating and need some
help with a part of it - given the following XML snippet:

<users>
  <user name="alf">
    <lines>7</lines>
  </user>
  <user name="bert">
    <lines>78</lines>
  </user>
  <user name="charlie">
    <lines>731</lines>
  </user>
  <user name="derek">
    <lines>62</lines>
  </user>
</users>

..what I'm trying to achieve is an XHTML table with 5 columns and
however many rows are necessary (imagine there may be a hundred or so
users) where the items in the table consist of only the users where the
user's line count is above 25 and is sorted by their line count.

So for the above snippet the output should be:

<table>
  <tr>
    <td>charlie (731)</td>
    <td>bert (78)</td>
    <td>derek (62)</td>
  </tr>
</table>

..obviously with more columns per row and more rows depending on the
size of the input document.

I've tried to do this using a template matching the next-siblings of the
users to achieve the grouping, but then I can't sort the items or select
the ones I want because the XPath works on the input node set and not a
node set I've selected myself (using for-each or a template).

If it makes any difference I'm using libXSLT 1.1.22 to do the
transformation.

Can anyone give me any pointers with this?

Thanks,
Steve


--~------------------------------------------------------------------
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>