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

Complicated next for-each and need to display page not

Subject: Complicated next for-each and need to display page not found if no data
From: Chris Hughes <chris_hughes22@xxxxxxxxxxx>
Date: Tue, 9 Sep 2008 23:02:22 +0000 (GMT)
 Complicated next for-each and need to display page not
Hi all

Im trying to write a solution where if no data is found I write out a message
saying so and if data is found I continue to process on the assumption that
the innermost nested for-each will find some data.

The problem is that my check says there is data, but my inner most for each on
"Race" finds no data.  Therefore I end up with header info and no detail....

The following is snippets of my code..

  <xsl:variable name="getdata" select="/ORCB082/ROWSET/ROW
    [Fixture/Race/RaceType &gt;= $racetypefrom]
    [Fixture/Race/RaceType &lt;= $racetypeto]
    [Fixture/Race/RaceAgeFrom &gt;= $agefrom]
    [Fixture/Race/RaceAgeTo &lt;= $ageto]
    [Fixture/Race/RaceDistance &gt;= $racedistancefrom]
    [Fixture/Race/RaceDistance &lt;= $racedistanceto]
    [Fixture/FixtureDate &gt;= $datefrom]
    [Fixture/FixtureDate &lt;= $dateto]" />

<!-- If no data has been found -->
  <xsl:if test="not($getdata)">
NOTHING FOUnd!!
  </xsl:if>

<!-- If data is found -->
  <xsl:if test="($getdata)">
I OUTPUT OVERALL HEADER
    <xsl:for-each select="$getdata">
I OUTPUT ROW HEADER
      <xsl:for-each select="Fixture[FixtureDate &gt;= $datefrom]
                                   [FixtureDate &lt;= $dateto]">
I OUTPUT FIXTURE HEADER
        <xsl:variable name="racedata">
          <xsl:for-each select="Race[RaceType &gt;= $racetypefrom]
                                    [RaceType &lt;= $racetypeto]
                                    [RaceAgeFrom &gt;= $agefrom]
                                    [RaceAgeTo &lt;= $ageto]
                                    [RaceDistance &gt;= $racedistancefrom]
                                    [RaceDistance &lt;= $racedistanceto]">
            <xsl:sort select="RaceCloseDate"/>
            <xsl:copy-of select="."/>
          </xsl:for-each>
        </xsl:variable>


        <xsl:for-each select="$racedata/*">
I WANT TO OUTPUT RACE DATA BUT I DON'T GET HERE????
.
.
.
.

This is an overview of my code  - I built this using ideas pinched from
various forums i.e. put the for-each into a variable then do an if for the no
data found.  None of the examples I saw used nested for-each's though.

I'm sure I'm missing something simple somewhere but its late so any help from
the usual suspects would be much appreciated.

Thanks in advance.

Chris

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.