xsl-list
[Top] [All Lists]

Re: [xsl] <xsl:for-each> , only loop on half of the elements.

2010-07-26 09:34:35
On 26/07/2010 15:30, Red Light wrote:


i have a pretty weird use case :

i have a node contained number of elements but late say i got 6 elements i only 
need to first 3.

Why is that weird? isn't selecting a subset of an xml document what XSLt is mainly designed to do?

<xsl:for-each select="/content/collaborator[position() &lt;= (last() div 2)]">
.


i know that this kind of things should be treated in data source
level
... , i'm using apache Fop to print my reports and i use the data that
comes thru a webservices so can't modify it .. any way in my xsl to use
only the NUMBER_OF_ELEMENT / 2 ?


position() &lt;= (last() div 2)]

as above

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