RE: [xsl] count selected nodes in for-each

Subject: RE: [xsl] count selected nodes in for-each
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 04 Apr 2001 11:58:30 +0100
Hi Kristof:

At 04:23 PM 4/4/01, you wrote:
xsl:choose is outside the xsl:for-each of course

Why "of course"?

Ahh -- given your example, it seems you want some logic like:

<xsl:for-each select="(...)">
<xsl:if test="(no nodes were handled by for-each)">

Then you could just do

<xsl:for-each select="document('../../released_xml/news_xml_en/newsticker.xml')/News/Block[@STARTDATE = '01']" >...</xsl:for-each>
<xsl:if test="not(document('../../released_xml/news_xml_en/newsticker.xml')/News/Block[@STARTDATE = '01'])">...</xsl:if>

or, more efficiently and clearer:

<xsl:variable name="blocks" select="document('../../released_xml/news_xml_en/newsticker.xml')/News/Block[@STARTDATE = '01']"/>
<xsl:for-each select="$blocks" >...</xsl:for-each>
<xsl:if test="not($blocks)">...</xsl:if>

But of course I'm still guessing a bit as to what you're trying to do...:-)


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: woensdag 4 april 2001 17:11
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] count selected nodes in for-each

> ...

you haven't said whether the xsl:choose is inside or outside the

If it's inside then you can use last() otherwise you can use
   [@STARTDATE = '01']" )


XSL-List info and archive:

====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

XSL-List info and archive:

Current Thread