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

RE: Flagging for No records found?

Subject: RE: Flagging for No records found?
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 11 Feb 2004 10:20:59 +0200
xslt no records
Hi,

> I am trying to implement some logic to see if my XSL code 
> found, and then
> displayed, any records. Try as I may I cannot find a clean 
> way to do this. I
> cannot set a flag, nor can I increment a count when I find a 
> record so I
> don't know how else to trap this. If no records meet the 

If you're trying to change the value of a variable, you're out of luck in XSLT.

> criteria then I'd
> simply like to output a 'No Records Found' message.
> 
> The code below is an extract from the XSL, if I don't display 
> any results
> then at the end I want to print 'No records found'.
> 
> Any ideas? Thanks!
> 
>   <xsl:template match="/">
> 
>      <xsl:for-each select="xdql/object/content/content_chunk">
> 
>       <xsl:sort select="content_link"/>
> 
>       <xsl:choose>
> 
>        <xsl:when test="((product = $product) or ($product = 'All'))">
> 
>          <!-- I need to know if I ever got here .... -->

xsl:message for debugging messages is always useful.
 
>            <a>
>             <xsl:attribute name="href"><xsl:value-of
> select="content_link/@ref"/></xsl:attribute>
>             <xsl:value-of select="content_link"/>
>            </a>
> 
>            <br/>
> 
> 
>        </xsl:when>
>       </xsl:choose>
> 
>      </xsl:for-each>
> 
>      <!-- Print 'no records found' if nothing passed the ;when

<xsl:if test="not(xdql/object/content/content_chunk)">
  <xsl:text>no records found</xsl:text>
<xsl:if>

You might want to store the "xdql/object/content/content_chunk" node-set into a variable for performance.

Cheers,

Jarno - Tactical Sekt: Xfixiation (Myer Burns the Dancefloor mix by Haujobb)

 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.