Does sightly template render based on a condition?
e.g. component.html render based on arguments
if argument one exist
<div data-sly-use.myComponent="${'com.myproject.service' @ param1='one''}">
${myComponent.calculatedValue}
</div>
if argument two exist
<div data-sly-use.myComponent="${'com.myproject.service' @ param2='one''}"">
${myComponent.calculatedValue}
</div>
if argument doesn't exist
<div data-sly-use.myComponent="${'com.myproject.MyComponent'}">
${myComponent.calculatedValue}
</div>
Question 2: How to get param1='one' value (from javascript or jsp)
Question 3: is it possible to do string operation on this value ${myComponent.calculatedValue}
Conditional rendering in HTL/Sightly is possible by using
data-sly-test
(see SPEC):This allows you to instantiate different Use Objects based on a parameter. The parameter must be defined inline, accessed via the available bindings/global objects or via another Use Object.
Operations are not supported in HTL expressions at this moment.