Re: err:XD0008 (more than one document in context) when not referring to the context

On 27 May 2013 20:14, Geert Josten wrote:

> Why can't you just use a //mypath-to-param on multiple input docs in
> one blow?

  The most obvious answer that comes in mind is that it is not what
XPath defines.  An initial "//" is defined to be a shorthand to
"(fn:root(self::node()) treat as document-node())/descendant-or-
self::node()/" (see "§3.2 Path Expressions" in XPath 2.0).

  So it is anchored at the root of the context node.  And the context
node is not defined when there is more than one document on the
connection for a p:with-option.

  But in addition to not raise an error when more than one document
appears to the connection of a p:with-option, we could even provide
those documents to the XPath expression as well.  Using "//" is not
possible with XPath, but a variable or a collection (maybe the default
collection) are possible choices:

    collection()//mypath-to-param
    collection('http://www.w3.org/ns/xproc-input')//mypath-to-param
    $p:input//mypath-to-param

  I am not entirely convinced though, even if I have to admit that
dealing with sequences of documents in XProc is sometimes quite
tedious...

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Received on Monday, 27 May 2013 20:41:26 UTC