xsl-list
[Top] [All Lists]

Re: [xsl] current-dateTime()

2008-04-18 08:08:41
On 18/04/2008, Liam Quin <liam(_at_)w3(_dot_)org> wrote:
On Fri, Apr 18, 2008 at 02:05:52PM +0100, Andrew Welch wrote:
 > It should be straightforward to write an extension function instead...


Actually no.  A conformant implementation is allowed to call an
 extension function only once for any given argument value, and
 to remember the results, to make it stable.  A give implementation
 might let you write such an extension function as you want, but
 there's no guarantee.

 In addition, suppose you have a stylesheet that does, say

    xsl:for-each 1 to 1000
        value-of current-time

 the implementation doesn't have to start at 1 and evaluate the
 "loop"  a thousand times.  Instead, this could be written as,
    map the items in the sequence (1 ... 1000)
    to the value of current-time
 with current-time being called once.

 Or, the implementation could start at 1000 and work downwards,
 and as long as it ended at 1 and put the results in the right
 order, you coudn't tell.

Sure, but below the XSLT level there is the concept of time per
mapping so if you can call out to that level you should be able to
output some reasonable progress messages - this is helpful in the
context of a standalone transform controlling the overall process as
opposed to some host language controlling the transform (where there
would be other ways of indicating progress).

From my own point of view, a lot the transforms I write are standalone
where the transform pulls in the source data itself, processes it in
some way and outputs various result files - the transform is the host.

(It would've been good if there was a default initial template name
(like #default) which would indicate the template to start at if no
initial template was supplied - this would allow XSLT files to be
executed in the simplest way by say just double clicking them rather
than needing to supply an input or initial template... but thats
another story.)

The point worth mentioning is that with custom extensions you are
tying yourself to a particular processor anyway - and sometimes to a
particular version.  Given that version you have a fair understanding
of the order of execution, so I think you could expect certain
behaviour happy in the knowledge that your code isn't portable and
even it was might not behave the same on a different processor.

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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

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