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

Setting flags ?

Subject: Setting flags ?
From: john.gough@xxxxxxxxxxxx
Date: Mon, 29 Jul 2002 12:46:13 +0100
xsl flag
I am a beginner with XSLT and have found this list a great source of help
and advice and i have a built a search  page which works just fine and uses
.asp to get the $searchValue1 string from the user, but i can not work out
how to display a value at the end of the search if NONE of the nodes in the
first for-each contained a match to the string.

Have cut some of the code out to make it clearer what i am trying to do. 

I can not seem to set the $flag in the for-each, If i use a variable $Flag
i get a out of scope error and if i use a parameter, i get Keyword
xsl:param may not be used here.  I think i am trying to do this the wrong
way and wonder if somebody can point me in the right direction.

Thanks

<?xml version='1.0' ?>
<xsl:stylesheet version ="1.0"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="searchValue1"/>
 
<xsl:template match="/">

<xsl:for-each select="index/indexitem">
<xsl:choose>

    <!--Same Case-->
    <xsl:when test = "contains(@text,$searchValue1)">
 <option>
     <!--Match - do stuff here-->
 </option>
      </xsl:when>

   <!--All Upper Case-->
        <xsl:when test =
"contains(@text,translate($searchValue1,'abcdefghijklmnopqrstuvwxyz',
             'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))">
 <option>
     <!--Match - do stuff here-->
 
 </option>
 
      </xsl:when>

    <!--All Lower Case-->
        <xsl:when test =
"contains(@text,translate($searchValue1,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
             'abcdefghijklmnopqrstuvwxyz'))">
 <option>
     <!--Match  - do stuff here-->
 </option>
 
      </xsl:when>

    <!--1st Upper Case-->

        <xsl:when test =
"contains(@text,concat(translate(substring($searchValue1,1,1),'abcdefghijklmnopqrstuvwxyz',
             'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring($searchValue1,2)))">
 <option>
     <!--Match - do stuff here-->

 </option>
 
      </xsl:when>
</xsl:choose>

</xsl:for-each>
   
 
<xsl:choose>
  <xsl:when test="$Flag"></xsl:when>
     <!-- Flag exists so do nothing -->
   <xsl:otherwise>
        <option>
     <!-- Display the 'Nothing Found Sorry' Message -->
 </option>
</xsl:otherwise>
</xsl:choose>

</select>



 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.