[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Increasing sequence ?


Subject: Re: [xsl] Increasing sequence ?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Mar 2015 19:09:33 -0000

Leo,

> Dimitre, yes, this is nice, however can not be used in xsd:assertions.

Do you mean that you cannot use an XSLT function?

>  And there is a stack problem with large sequences.


There shouldn't be such problem with this particular function, if the
XSLT processor recognizes and optimizes tail recursion.


Cheers,
Dimitre

On Thu, Mar 26, 2015 at 11:27 AM, Leo Studer leo.studer@xxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Dimitre, yes, this is nice, however can not be used in xsd:assertions.
> And there is a stack problem with large sequences.
>
> Thanks anyway
> Leo
>
>> On 25.03.2015, at 18:36, Dimitre Novatchev dnovatchev@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>>> every $v in 1 to (count($sequence)-1) satisfies ($sequence[$v] lt $sequence[$v+1])
>>
>> This may be inefficient (depending on the XPath engine being used).
>>
>> I think the following has better chances of being more efficient --
>> write an xsl:function, name it, say, "increasing". The body of this
>> function can be just:
>>
>>    not($seq[2])  or $seq[1] lt $seq[2]  and  increasing(subsequence($seq, 2))
>>
>>
>> Cheers,
>> Dimitre
>>
>>
>> On Wed, Mar 25, 2015 at 10:20 AM, Leo Studer leo.studer@xxxxxxxxxxx
>> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>> A similar problem as before, is the integer sequence increasing?
>>>
>>> this is my solution:
>>>
>>> every $v in 1 to (count($sequence)-1) satisfies ($sequence[$v] lt $sequence[$v+1])
>>>
>>> Do you have a better one?
>>>
>>> Cheers
>>> Leo


Current Thread
Keywords