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

Re: Problem with conditional definition of a variable

Subject: Re: Problem with conditional definition of a variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 4 Jan 2006 17:37:16 GMT
value definition
> "phase" is defined without a default value.

parameters always have a default value. If you give no select attribute
and no content the value is "" which is the same value that an variable
defined with xsl:variable with no select attribute and no content gets.
(in xslt2 there are other possibilities depending on the as attribute,
but the basic feature is the same variables always have a value)

So you can not distinguish the case that the parameter value was not
passed in, and the case that the default value was explictly passed.
If you need to distinguish these cases, you need to make the default
something that is unlikely (or impossible) to be passed in.

For example in many command line systems you can only pass in string
values, so if you make the default value select="/" and the value that
you have is a node, then no value was passed in explictly.

However assuming that you were not stumbling over edge cases like
passing in "" then

   <xsl:when test="$phase=''">
      <!-- Something goes here when no "phase" parameter is passed -->

That should work except that it is "no parameter is passed, or the
parameter is is passed with value which has a string value of "")
so perhaps you need to give a more complete example.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.