[xsl] Problem with conditional definition of a variable

Subject: [xsl] Problem with conditional definition of a variable
From: cknell@xxxxxxxxxx
Date: Wed, 04 Jan 2006 12:19:44 -0500
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/requirement[@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