This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Accessing nth element
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Accessing nth element
- From: "bharat chintapally" <hydbad at hotmail dot com>
- Date: Sun, 06 May 2001 16:22:03 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi janning:
Thanks for your response..But I did not see any difference in performance
when I tried the following
<xsl:for-each select="./records[position() < 20]">
or when I used template for record.
My question is how does the select in the for-each behave.. When we select
by using the "select="./records[position() < 20]" does the XSLT processor
return when the the cursor (db like) moves past
record # 20 (like a for loop; return when the termination condition is met)
or does it go loop all the n records
(in particular 20 thru n).
The more I look at it, I feel that I should be using a for-loop (or
recursion) here..
Any suggestions are welcome..
Thanks
--bharat
Janning Vygen <vygen@planwerk6.de>
Sent by: owner-xsl-list@lists.mulberrytech.com
05/01/01 09:23 AM
Please respond to xsl-list
To: xsl-list@lists.mulberrytech.com, Bharat.Chintapally@CommerceQuest.com
cc:
Subject: Re: [xsl] Accessing nth element
Am Dienstag, 1. Mai 2001 15:04 schrieb
Bharat.Chintapally@CommerceQuest.com:
>Hello all:
> I think I need to replace for-each in my XSLT's with recursion. I am
>interested in picking 'x' elements from 'y' (20 for each page from 500
>records) for paging. for-each is working fine, but it is overkill, I should
>be able to terminate (return from as in procedural lang's) processing when
>I finish processing 20 records for a given page.
> I am trying to switch to recursion, but have a quick question. Is
>there a way to fetch an n'th element from given bunch of records. For
>example when I am processing records 20 thru records 40 out of 500 records,
>I would like directly fetch the record #20 from all the records. Is it
>possible..
try something like this
<xsl:for-each select="./records[position() < 20]">
not tested, but with position function inside your XPath expression you
should get the records you want.
janning
--
Planwerk 6 /websolutions
Herzogstraße 86
40215 Düsseldorf
fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list