xsl-list
[Top] [All Lists]

Re: [xsl] Increasing sequence ?

2015-03-26 14:09:47
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(_dot_)studer(_at_)varioweb(_dot_)ch
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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(_at_)gmail(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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(_dot_)studer(_at_)varioweb(_dot_)ch
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>