xsl-list
[Top] [All Lists]

Re: [xsl] sorting based on variable and limit the results

2009-03-22 19:40:45

is it possible to sort based on xsl:variable? If so, how?
yes but xsl:sort needs to be the first child of for-each.

In xslt2 you can use the content of xsl:sort rather that a select
attribute which allows a wider range of constructs. You didn't say
if you wanted xslt 1 or 2.


But you don't need a variable  you could do

<xsl:key name="p" match="p" use="pp"/>
....


<xsl:for-each select="//s">
  <xsl:sort select="count(key('p',n))"/>
  <tr><td><xsl:value-of select="n"/></td>
      <td><xsl:value-of select="count(key('p',n))"/></td></tr>
</xsl:for-each>

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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