Re: [xsl] Param redirection

Subject: Re: [xsl] Param redirection
From: Steve <subsume@xxxxxxxxx>
Date: Mon, 31 Jul 2006 14:41:38 -0400
<xsl:variable name="result">
<xsl:choose>
  <xsl:when test="$a_or_b" = $a> <!-- or "a" if that's what you mean -->
        <xsl:value-of select="$a" />
  </xsl:when>
  <xsl:when> <!-- or <xsl:otherwise> ... -->
       <xsl:value-of select="$b" />
   </xsl:when>
</xsl:choose>
</xsl:variable>

then <xsl:value-of select="$result" />.
-Steve

On 7/31/06, David Nesbitt <dnesbitt@xxxxxxxxxxxxxxxxx> wrote:
This is a question about how to program with XSLT.

I would like to have the following parameters in my stylesheet:

<xsl:param name="a_or_b"/>
<xsl:param name="a"/>
<xsl:param name="b"/>

If the value of param "a_or_b" is "a", I would like to output the value
of param "a".  If the value of param "a_or_b" is "b", I would like to
output the value of param "b".

How can I use the value of one param (i.e. "a_or_b") as the name of the
param for the value-of element?  Or is there another way to accomplish
this redirection in XSLT?

Thanks in advance for any assistance.

Regards,
Dave

Current Thread