title: Grails: How do you call a tagLib inside a GSP expression?
body: <p>So I have this tagLib;</p>
  
  <pre><code>def trimTo = { attrs, body -&gt;
      int length = attrs.int('length')
      String text = body()
      if (text.size() &gt; length) {
          text = text.substring(0, length - 1) + '...'
      }
      out &lt;&lt; text
  }
  </code></pre>
  
  <p>Normally I'm using it like this;</p>
  
  <pre><code>&lt;g:trimTo length="50"&gt;${fieldValue(bean: fooInstance, field: "textEng")}&lt;/g:trimTo&gt;
  </code></pre>
  
  <p>And all is good.</p>
  
  <p>But I want to call it in a g:select tag that looks like;</p>
  
  <pre><code>&lt;g:select name="phrases" from="${Foo.list()}" optionValue="${{it.textEng}}" multiple="multiple" optionKey="id" size="25" value="${fooParentInstance?.children*.id}" class="many-to-many"/&gt;
  </code></pre>
  
  <p>Specifically I would like to use it to shorten what is being displayed by the optionValue attribute, the results of {it.textEng}.</p>
  
  <p>I have tried several different combinations can can't seem figure out the correct syntax.</p>
  
  <p>Thanks in advance for any assistance.</p>
  
  <p>*edited for spelling</p>