xsl-list
[Top] [All Lists]

Re: Just the first 'x' elements within a for-each

2003-03-18 04:10:16
Hi Si,

[Using a predicate] doesn't seem to want to work whereas using:

<xsl:if test="position() &lt;= 2">

within the for-each does? Might this be something to do with the XSL
parsing in XML Spy 5?

I guess that it could be: if you haven't got MSXML3 installed, then
XML Spy might be using MSXML2, which doesn't support XSLT. But that
would depend on the namespace that you're using in the stylesheet. You
don't describe in what way it "doesn't work", so it's hard to tell.

Can you show a full stylesheet with the code that doesn't work and the
code that does?

Oh and I had a good look around but couldn't find a simple
description for 'declarative programming'?

I think of it in terms of programming by saying *what* you want to do
rather than in terms of *how* you want to do it. So instead of
phrasing your requirement in procedural terms as "I want to loop over
all the nodes and stop after the second", say "I want to process the
first two nodes".

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list