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

Re: XProc document templates - a question about undeclared variables

From: Florent Georges <fgeorges@fgeorges.org>
Date: Mon, 8 Nov 2010 14:56:39 +0000
Message-ID: <AANLkTi=kLW1eVa0DHExGUsrQMmi4sx+ABknEUcdopTDR@mail.gmail.com>
To: Philip Fennell <Philip.Fennell@marklogic.com>
Cc: XProc Dev <xproc-dev@w3.org>
On 8 November 2010 14:15, Philip Fennell wrote:

>> If you want the resulting document to contain the 6 chars {,
>> $, f, o, o and }, then you have to escape the curly braces by
>> doubling them: {{$foo}}.

> If that were the case then I'd have to un-escape the expression
> before I tried to evaluate the query using p:xquery. I'd be
> exchanging one complication for another.

  I am not quite sure we are actually speaking about the same
thing.  Let's say we have the following passed to the step
p:document-template:

    <elem>{{ $foo }}</elem>

This will resolve in the following:

    <elem>{ $foo }</elem>

which, if it is in turn passed to the xquery step, will resolve
to (say $foo is bound to 42 in the query):

    <elem>42</elem>

  That's the principle of double-escaping we find in any language
generating another piece of code (in the same language or
another).  Here, if you try to generate XQuery (which uses curly
braces as special characters), you need to escape them in the
step p:document-template (which also use the curly braces as
special characters).

  Regards,

-- 
Florent Georges
http://fgeorges.org/
Received on Monday, 8 November 2010 14:57:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 8 November 2010 14:57:33 GMT