xsl-list
[Top] [All Lists]

Re: [xsl] xsl:import and use-when

2014-05-16 06:54:47


Cheers,
Peter

-----Original Message-----
From: Michael Kay mike(_at_)saxonica(_dot_)com [mailto:xsl-list-
service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Sent: May 16, 2014 03:59
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] xsl:import and use-when


On 16 May 2014, at 03:09, Abel Braaksma (Exselt) abel(_at_)exselt(_dot_)net 
<xsl-list-
service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


On 16-5-2014 2:49, Rushforth, Peter 
peter(_dot_)rushforth(_at_)nrcan-rncan(_dot_)gc(_dot_)ca
wrote:
With regard to statically known available documents [2], the spec says
that statically known documents [3] in the static context [4] are used to
provide static type information, not to determine which documents are
available.  But if a document is statically known, it is potentially 
available using
the doc() function, hence I think the use of doc-available() in use-when
should be legal, although if it isn't it isn't.

You are quoting the XPath spec here, which allows enough breath for host
languages to provide a list of statically available documents. However,
in the section that you also refered to,
http://www.w3.org/TR/xslt20/#conditional-inclusion, you should scroll
down until the bottom of the first table, there is says:

Statically known documents     None
Statically known collections     None

I see that now, thanks.



Actually and rather confusingly, it's the "available documents" in the dynamic
context that matters, not "statically known documents" in the static context.
Use-when expressions (and in XSLT 3.0, other static expressions) are
evaluated during stylesheet analysis, so their dynamic execution occurs
during the XSLT static analysis (compilation) phase; their dynamic execution
has a dynamic context, and it is this that determines the results of doc() and
doc-available().

I see, thanks.


Saxon still implements the 2.0 restriction on using doc() in use-when
expressions, despite the relaxation in the spec. I can't see any particular
reason not to lift the restriction (which can be done by removing one line of
code and adding a load of test cases....). Oh, looking at it more carefully, 
I see
that there would be no document pool maintained across a compilation, so
multiple calls on doc() to fetch the same document would be grossly
inefficient.

But useful!
 

I guess I will try an extension function.

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