On Fri, Aug 17, 2012 at 11:54 PM, Michael Kay <mike(_at_)saxonica(_dot_)com>
wrote:
That rather depends on the time complexity of substring().
Saxon should evaluate substring() in constant time once it has established
that the string contains no surrogate pairs, which is only done once for a
given string.
Michael Kay
Saxonica
This is exactly what I meant by "in the absence of a good optimizer"
-- there certainly are XSLT processor that have optimal implementation
for substring().
Should we assume that every XSLT processor is that smart? I believe -- not.
Of course, measurements will definitely show what is the case with a
specific XSLT processor. The results could also be possibly different
for substring() with a string literal as its first argument and when
the first argument is the string value of a node (calculated).
Cheers,
Dimitre
On 18/08/2012 04:33, Dimitre Novatchev wrote:
On Fri, Aug 17, 2012 at 7:17 PM, Mukul Gandhi
<gandhi(_dot_)mukul(_at_)gmail(_dot_)com>
wrote:
Hi Robby,
Here's another variant of the solution,
for $x in 1 to string-length($stringVal) return substring($stringVal, $x,
1)
But the solution with string-to-codepoints(..) etc is equally good.
The solution given by Michael Kay:
for $c in string-to-codepoints($s) return codepoints-to-string($c)
can be much more efficient (linear time complexity) than the above
expression that calculates substring N times. (O(N^2) in the absence
of a good optimizer).
Cheers,
Dimitre.
On Fri, Aug 17, 2012 at 8:04 PM, Robby Pelssers
<Robby(_dot_)Pelssers(_at_)nxp(_dot_)com>
wrote:
Hi guys,
Probably the stupidest question since a while but what would be the
preferred way to split a word into a sequence of letters ;-)
Cheers,
Robby
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
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>
--~--
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.
--~------------------------------------------------------------------
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>
--~--