[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: count selected nodes in for-each

Subject: RE: count selected nodes in for-each
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 04 Apr 2001 11:58:30 +0100
xsl for each count
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:for-each>
<xsl:if test="(no nodes were handled by for-each)">
</xsl:if>

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...:-)

Cheers,
Wendell

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


> ...


you haven't said whether the xsl:choose is inside or outside the
for-each.

If it's inside then you can use last() otherwise you can use
 count(document('../../released_xml/news_xml_en/newsticker.xml')/News/Block
   [@STARTDATE = '01']" )

David

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

====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 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: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.