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

Re: How to tell if no data returned

Subject: Re: How to tell if no data returned
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 2 Oct 2006 09:35:02 +0100
if no rows returned
On 10/2/06, Garry <garry@xxxxxxxxxxxxxxxxxx> wrote:
Hi all

I have a problem which I would normally fix using a variable. I have a
routine similar to that below. What I want to know is if it doesnt get into
the for-each loop. If it doesnt it means no rows are written and I would
like to add a note to the page if this is the case.

<xsl:for-each
select="/stages/competition/leg/stage/classification/competitor[../../@no=$s
Num]">
<xsl:if test="../@type = 'STAGE'">
<xsl:if test="../../../../@cno=$paramVal1">

... row detail written here

</xsl:if>
</xsl:if>
</xsl:for-each>

Well a exact conversion would be:


<xsl:variable name="competitors"
select="/stages/competition/leg/stage/classification/competitor[../../@no=$sNum]"/>

<xsl:choose>
 <xsl:when test="$competitors">
   <xsl:for-each select="$competitors">
      ....
  </
 <xsl:otherwise>
   note....


But if those xsl:if's are the only children of the xsl:for-each then the variable should really be:

select="/stages[@cno=$paramVal1]/competition/leg/stage[@no=$sNum]/classification[@type
= 'STAGE']/competitor"

cheers
andrew

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.