W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2011

Re: Initialize a variable with a parameter port

From: Norman Walsh <ndw@nwalsh.com>
Date: Mon, 21 Nov 2011 14:56:22 -0500
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <m2obw5s109.fsf@nwalsh.com>
Florent Georges <fgeorges@fgeorges.org> writes:
>   I try to get a parameter value in a variable, by connecting the
> variable context to a prameters port and using an expression like
> "/c:param-set/c:param[...]/@value".  But Calabash gives me the
> following error:
>     err:XD0008 : More than one document in context for parameter
>     'first' It is a dynamic error if a document sequence appears
>     where a document to be used as the context node is expected.
>   I use Calabash 0.9.40.  A complete repro is:

Hmm. Given that there's only one parameter, I'm surprised that doesn't
work. But in the general case, what appears on the parameters input
port is a sequence so that approach isn't going to work reliably

The safe way to do this is to wire a p:parameters step into the top of
my:params-try and read from that to initialize the variable. This will,
alas, require another p:group.

Longer term, maybe there should be a p:parameter() *function* that
takes the name of an in-scope parameter and returns its value. Pushing
the parameters into a document in order to read the value back out of
the document does seem like going around the houses.

                                        Be seeing you,

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676

Received on Monday, 21 November 2011 19:57:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:09 UTC