Re: [xsl] getting the first three

Subject: Re: [xsl] getting the first three
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 18:23:25 +0100
Hi Sandeep,

> i need to get the first three child elements of a particular node to
> print out?
> is this the right syntax? "position() &lt; '4' ". it doesn't work on
> our server :(

That test is 'correct' in that it will return true if the position of
the context node when you do the test is less than 4. You haven't
given any indication about the context the test is used in, but
from the fact that it's not working at the moment, then I guess you're
not using it like:

  <xsl:apply-templates select="*[position() &lt; 4]" />

This would apply templates to the first three child elements of the
current node, so you should place it in the template that matches the
'particular node' that you refer to in your first paragraph.

If this wild guess doesn't help, I really recommend posting a sample
of the source XML that you're using, the stylesheet that you're trying
to use, and the output that you want.

I hope that helps anyway,


Jeni Tennison

 XSL-List info and archive:

Current Thread