xsl-list
[Top] [All Lists]

Re: [xsl] A smarter choose operation XSL 1.1

2009-06-10 19:04:56
Performing this simple test:
        <xsl:variable name="test" select="(1, 2, 3)[1]" />

I am getting the error:
  Error in expression (1, 2, 3)[1]: expected ")", found ","

Did I write that wrong?

Karl..

On Wed, Jun 10, 2009 at 3:16 PM, Karl Stubsjoen<kstubs(_at_)gmail(_dot_)com> 
wrote:
I am not worthy!
OK, I will give this a try, thanks!

On Wed, Jun 10, 2009 at 2:53 PM, Michael Kay<mike(_at_)saxonica(_dot_)com> 
wrote:
select="(1.0, 1.7, 2.25, 3.0)[count(($opt.one, $opt.two, $opt.three)[.])+1]"

The strange predicate [.] selects items in the sequence that are true.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay

-----Original Message-----
From: Karl Stubsjoen [mailto:kstubs(_at_)gmail(_dot_)com]
Sent: 10 June 2009 22:20
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] A smarter choose operation XSL 1.1

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..

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--