[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: "Xia Li" <xli@xxxxxxxxxxxxx>
Date: Wed, 4 Jan 2006 09:34:33 -0800
define a variable in xml
You can fill the blanks with the <xsl:value-of> to assign a value to the
variable or <xsl:sequence> to assign a result of a XPath expression to
the variable.


Lisa


-----Original Message-----
From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx]
Sent: Wednesday, January 04, 2006 9:20 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Problem with conditional definition of a variable

Depending on whether or not a parameter is passed to the stylesheet, I'd
like to define a variable differently.

I have defined two parameters in the stylesheet to be passed from a
command line:

"spiral" has a default value.
"phase" is defined without a default value.

This unconditional definition works as expected:

<xsl:variable name="s1-reqs" select="document('X:/Project
documents/matrix-xml/spiral-phase-update-template.xml')/requirements/req
uirement[@spiral=$spiral]" />

I think I ought to be able to declare the variable with a construct like
this:

<xsl:variable name="s1-reqs">
  <xsl:choose>
    <xsl:when test="$phase=''">
      <!-- Something goes here when no "phase" parameter is passed -->
    </xsl:when>
    <xsl:otherwise>
      <!-- Something goes here if a "phase" parameter is passed -->
    </xsl:otherwise>
  <xsl:choose>
</xsl:variable>

but I must have the wrong idea because I can't find a way to fill in the
blanks. If someone sees where I'm going astray, please clear this up for
me.

Thanks.

--
Charles Knell
cknell@xxxxxxxxxx - email

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.