Evandro Santos · May 25, 2016

Runtime Expressions in XML



I'm facing a problem when I try to use the Runtime Expression below inside the XData Contents:


It compiles correctly, but when I open the page on the browser I get the message "Expression Error" instead of "Testing!".


How could I use the $$$Text macro with Runtime Expressions? Is there a way to make this?



0 332
Discussion (5)1
Log in or sign up to continue

Actually, XData content it is a just XML, in it is stored exactly as you wrote it in IDE. But it is possible to compile any XData to any other format as you need, at this portal you can find two articles about how to do it, first and second. In your case it could be much easier, like some method which in compile mode gets all XData content and place it to &html<>, which then compile again as usual, and what you need after it is just call this generated method, to show this html. 

I couldn't see a way to use this approach in my case.

Should I override the %CreatePage ( method?

Thank you, Dmitry.

Thanks you Stefan.

I've already read that documentation but I've not noticed the text talking about macros.

I would like a way to use localization directly in XData, without any JS code. Nevertheless, I'm going to this zenText or JS $$$Text approach.

The <html> component does not handle localization for you out of the box, as you can inject arbitrary HTML into it.

Most of the other components do localize their captions and titles automatically if you set the DOMAIN parameter in your Zen page. A button component automatically creates a dictionary entry for its caption property, e.g.:

<button caption="Save"/>