Selecting XLM Elements for output in Thymeleaf -


if had structure this:

<tag> <item name="groot" group="a"/> <item name="starlord" group="a"/> <item name="rocket" group="a"/>  <item name="thanos" group="b"/> <item name="ronan" group="b"/> <item name="ego" group="b"/> </tag> 

how make template select either or b items matching variable?

example: selecting "group=a" because variable set a

<tag> <item name="groot" group="a"/> <item name="starlord" group="a"/> <item name="rocket" group="a"/> </tag> 

question

is possible eliminate "group=*" attributes since needed use in template?

example

<item name="groot"/> <item name="starlord/> <item name="rocket"/> 

alternatives?

i'm new thymeleaf other suggestions problem appreciated. in normal templating engine enclose grouped items within "a" , "b" blocks using instructions within comments , eliminate group attributes, understanding thymeleaf doesn't allow processing inside of comments.

the attributes don't need called "group", main thing in template identify group. if there more appropriate thymeleaf attribute fine too.

you can have @ th:if or, if have multiple cases, th:switch. short example:

<tag th:if="${obj.somecondition}">     <item name="groot"/> </tag>  <tag th:if="${not obj.somecondition}">     <item name="thanos"/> </tag> 

where obj object registered thymeleaf context (can't find apidoc 3.0 @ moment)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -