I have a xslt template that creates a FOP file that, afterwards, I want to evaluate with velocity. When I have something like this:
<fo:basic-link internal-destination="${variableOutside}">
${variableInside}
</fo:basic-link>
Both variables "variableInside" and "variableOutside" are supposed to be evaluated by velocity and NOT by XSLT.
However, after the first XSLT transformation, what I get is:
<fo:basic-link internal-destination="$">
${variableInside}
</fo:basic-link>
That is, the variableInside has already been evaluated because XSLT assumes this is not a literal string but a variable and, since it doesn't have any value for it, it leaves it blank.
VariableOutside is, however, left unused because it is not in an attribute I guess.
Now, I know I can get rid of the curly braces and that will work, but sometimes, I need to only convert one part of the text, so, for example:
${variableOutside}.field1
Should become
valueofvariable.field1
And if I don't use the curly braces, Velocity will assume that I am looking for the field1 inside variableOutside which doesn't exist.
So, my question is, how do I escape the curly braces? I have tried with both "/" and "\" (double and single) and also with { and } but none of them work.
If you want to literally output curly braces in an attribute, rather than have XSLT treat them as Attribute Value Templates, use double braces
<fo:basic-link internal-destination="${{variableOutside}}">