Is there a proper way to deal with variables (in layout.xml) that may or may not be defined?
I tried various approaches:
XPath exists(), which is not implemented – and not easy to implement as default_function due to the way the engine works, on first sight.
Check for definition in the Lua filter and set to empty string if it is not – but setting variables is not supported there.
Current workaround is to just expect the variable to be set, if unused to an empty string. Otherwise sp will throw errors during the run, but the output will still be correct. So in the end this is more of a cosmetical issue.
Is there a proper way to deal with variables (in
layout.xml
) that may or may not be defined?I tried various approaches:
exists()
, which is not implemented – and not easy to implement as default_function due to the way the engine works, on first sight.Current workaround is to just expect the variable to be set, if unused to an empty string. Otherwise sp will throw errors during the run, but the output will still be correct. So in the end this is more of a cosmetical issue.