[xsl] A smarter choose operation XSL 1.1

Subject: [xsl] A smarter choose operation XSL 1.1
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Wed, 10 Jun 2009 14:20:12 -0700
I have 3 optional param values that are either true/false.  I need a
solution which will return 4 different numbers when:

1) all param values are true
2) two param values are true
3) one param value is true
4) none are true

I was about to write one big choose and then thought maybe there is a
more efficient way of doing it.  So any ideas on this one?  For sake
of discussion, here is a mock up of the template and param values I
have:

<xsl:template name="test">
  <xsl:param name="optional.one" select="true()" />
  <xsl:param name="optional.two" select="true()" />
  <xsl:param name="optional.three" select="true()" />

  <!--
    Return:

    When All, return 3.00
    When Two, return 2.25
    When One, return 1.70
    When Zero, return 1.00
   -->

</xsl:template/>

Thanks for the help!

Karl..

Current Thread