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

Re: How can you tell if a variable exists?

Subject: Re: How can you tell if a variable exists?
From: "Scott Sanders" <scott@xxxxxxxxxxxx>
Date: Tue, 2 Nov 1999 08:33:00 -0800
xsl variable exists
> > How can you tell if a variable exists (or rather does not exist),
without
> > erroring out of the stylesheet.
>
> Since variables have to be declared before use, how can you _not_ know
> without testing whether or not a variable exists?
>
> Either the stylesheet declares the variable, or it doesn't. I must be
> missing something?

I have an HTML search form with an <input type=text name=search>.  When the
user posts the form back to the server, the SAXON servlet adds all post
parameters to the stylesheet BEFORE processing it.  I am trying to retrieve
XML data to include in the stylesheet using the document function to
retrieve a dynamically created XML page.  Something like :
       <xsl:variable name="documentUrl">
        <xsl:value-of select="$baseUrl"/>
        <xsl:value-of select="@type"/>
        <xsl:value-of select="$actionRecords"/>?sessionid=<xsl:value-of
select="$sessionid"/>
         <xsl:if test="$search">&amp;search=<xsl:value-of select="$search"/>
         </xsl:if>
       </xsl:variable>
       <xsl:for-each select="document($documentUrl)/records/record">
        Do something here....

You can see that I am using sessionid and search as variables.  sessionid is
ALWAYS passed in to the stylesheet, but search is not passed in because it
is not returned in the HTTP POST if the input is empty.  Thus search is
'undefined'.

Scott


 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.