Working with out-parameters
Release 1.4 - ...
You can now mark translation arguments as out-parameters, meaning that the translation can set more than only the return value.
Translation name:
Smartsite SXML | Copy Code |
---|---|
boolean TryGetItem(Locator url, out integer nr, out string title) |
Replacement:
Smartsite SXML | Copy Code |
---|---|
{buffer.set(nr, url.getitemnumber(translation.arg(url)))} {translation.setresult($nr GT 0)} <se:if expression="$nr GT 0"> {translation.setoutparameter(nr, $nr)} {translation.setoutparameter(title, itemdata.rawfield(title, $nr))} </se:if> |
The caller of the translation can then get access to the out-parameters in the 'onreturn' named argument of the call:
Smartsite SXML | Copy Code |
---|---|
<se:if expression="trygetitem(MY_GIVEN_PAGE_CODE, onreturn=buffer.set(n, translation.getoutparameter(nr)); buffer.set(s, translation.getoutparameter(title)))" trim="both"> <dl> <dt> Nr </dt> <dd> {buffer.get(n)} </dd> <dt> Title </dt> <dd> {buffer.get(s)} </dd> </dl> </se:if> |