Re: XProc document templates - a question about undeclared variables

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 UTC