Displaying Nested Elements

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Displaying Nested Elements

apprentice
What is the correct syntax for nesting a tag inside another? The <strong> tag in the example below will not display. I think I know why but not sure about the correct syntax to use.

 < span th="${foo}" ><strong> boo< /strong>< /span>
Reply | Threaded
Open this post in threaded view
|

Re: Displaying Nested Elements

Zemi
Administrator
Hello,

I'm not sure if I understand completely your question, but maybe the following will work for you:
 
    < span ><strong th="${foo}" > boo< /strong>< /span>

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Displaying Nested Elements

apprentice
If you take a look at the following example.  The span tag i.e. the message "label" appears correctly inside a span however the <strong> tag that is inside it fails to show.

< span class="lbl" th:text="#{label}">
        <strong id="example" th:text="${foo}" />
< /span>


It should be rendered as follows:

< span class="lbl">boo< strong id="example">foo< /strong>< /span>

Hope that is a little clearer.
Reply | Threaded
Open this post in threaded view
|

Re: Displaying Nested Elements

Zemi
Administrator
Yes, the th:text="#{label}" is overwriting the strong element.

You can render it several ways, the simpler is to introduce an auxiliary tag:

  < span class="lbl">
        < span th:text="#{label}">< /span>
        <strong id="example" th:text="${foo}" />
  < /span>

Other options include using th:utext and appending the strong tag to the span text.

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Displaying Nested Elements

apprentice
What will be the utext equivalent?