In Thymeleaf I would like to generate following HTML
<span data-my-attr>
</span>
I would like to display data-my-attr conditionally, but there seems to be no way how to display or NOT to display an empty attribute conditionally.
In case of required attribute there is th:required but for custom attributes there is nothing.
I tried to use th:attr="'data-my-attr'=${value}" and value is true or false, but it does not work.