xsl-list
[Top] [All Lists]

Re: [xsl] XSLT repetition constructs

2019-03-06 10:15:25
On Wed, Mar 6, 2019 at 5:01 AM John Lumley john(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


All of these are *mapping" operations, like the map function in
Haskell. These have nothing to do with repetition.

Note that the XSLT3.0 specification does actually describe these under a
chapter heading "Repetition".....


Then this is a mistake in the specification -- time for errata.
Repetition implies time passing during the transformation and there is
no notion of "passed time" or time-ordering of execution in XSLT. This
was by design. In fact special care was taken so that functions like
current-time() always return the same value during transformation.

To put it in other words, if we apply templates to a set of items and
output (using <xsl:message/>) the value of current-time() within the
selected template for each item, we get the same value -- so all these
operations were executed at the same time...  This definitely is not
"repetition"

And one can consider a mapping over a finite set of domain points as
'repeat this function over each of these points' ....

"Repeat" means do something first and then do it again. If we do not
specify what is to be done "first" then we cannot speak about
repetition.

It would be correct to say instead: "**Apply** this function on each of these"

Cheers,
Dimitre


On 05/03/2019 22:17, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com wrote:
It isn't correct to use "repetition" for a set of operations that are
independent from each other and can be executed in any order or in
parallel.

In this group fall such operations as <xsl:for-each>. the XPath for
expression, the ! (bang) operator and applying a function in the last
location step of an XPath step-expression (sorry if I don't remember
the exact terminology).

All of these are *mapping" operations, like the map function in
Haskell. These have nothing to do with repetition.

Note that the XSLT3.0 specification does actually describe these under a
chapter heading "Repetition".....

And one can consider a mapping over a finite set of domain points as
'repeat this function over each of these points' ....

--
*John Lumley* MA PhD CEng FIEE
john(_at_)saxonica(_dot_)com <mailto:john(_at_)saxonica(_dot_)com>
on behalf of Saxonica Ltd




-- 
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
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
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
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>