xsl-list
[Top] [All Lists]

[xsl] Stability of documents

2008-01-07 00:05:05
"Andrew" == Andrew Welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> writes:

    Andrew> It's a really common requirement - thankfully there's the
    Andrew> collection() function in XSLT 2.0 which makes it really
    Andrew> straightforward - one of the "killer-app" features of 2.0
    Andrew> in my opinion, if not the best of the lot.  Whether it was
    Andrew> intended or just there because of XQuery would be
    Andrew> interesting to know...

    Andrew> Sadly it loses it's usefulness for large data sets without
    Andrew> an extension like saxon:discard-document... but you never
    Andrew> know as it's implementation defined something may emerge
    Andrew> where the documents are discarded by default.

I think that would be non-conformant:

"By default, this function is stable."

and:

"However, for performance reasons, implementations may provide a user
option to evaluate the function without a guarantee of stability. The
manner in which any such option is provided is
implementation-defined. If the user has not selected such an option, a
call of the function must either return a stable result or must raise
an error: [err:FODC0003]."

(both quotes are from F&O 15.5.4 - fn:doc)

Now you could have, for example, a command-line option to treat all
calls to doc() as non-stable. That would be conformant. You could then
put it in your shell-script/batch file that invokes the processor, and
so get what you are looking for.

Is this desirable? I can't make up my mind about this.

My first thought was that tolerance of instability is a
property of the transformation (e.g. you have coded it in such a way
that you know you won't be accessing the same document a second time
with the doc() (or document()) function), and therefore should be
marked in some way within the source text.

My next thought was that your environment might be such that you could
guarantee that document contents weren't going to change (for example
you were reading files exclusively from a CD-ROM), and that you never
wrote transformations that would notice a difference in such an
environment (or that your XSLT processor would never expose a
difference in such an environment - I believe that this is the case
for Gestalt, but not for Saxon - I don't know about Altova). 
But I'm not convinced that it is a good idea to rely on such arguments.
-- 
Colin Adams
Preston Lancashire

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