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

RE: Initialize a variable with a parameter port

From: Geert Josten <geert.josten@dayon.nl>
Date: Mon, 21 Nov 2011 22:03:16 +0100
Message-ID: <c8485d1844ad4812b39ac1b5cfe2bc17@mail.gmail.com>
To: Norman Walsh <ndw@nwalsh.com>, XProc Dev <xproc-dev@w3.org>
PS: +1 for a p:parameter function!!

-----Oorspronkelijk bericht-----
Van: Norman Walsh [mailto:ndw@nwalsh.com]
Verzonden: maandag 21 november 2011 20:56
Aan: XProc Dev
Onderwerp: Re: Initialize a variable with a parameter port

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 21:03:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:17:01 UTC