title: Facelet : <ui:insert> cannot be put inside attribute value problem
body: <p>Im currently experimenting with facelets in JSF 2.0.</p>
  
  <p>I currently have a case where a common grid definition is used by 2 facelets,
  differs only in some areas like the bean name, the list name, the title, the grid id.</p>
  
  <p>So what i have in mind is :</p>
  
  <ol>
  <li>create template for that grid, making use of <code>&lt;ui:insert&gt;</code> in the areas that can differ between pages that use it</li>
  <li>those 2 pages, make use of the template, supplying the parameters for the template with <code>&lt;ui:define&gt;</code></li>
  </ol>
  
  <p>Here is my gridTemplate.xhtml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"&gt;
  
  &lt;h:head&gt;
      &lt;title&gt;#{msgs.title}&lt;/title&gt;
  &lt;/h:head&gt;
  
  &lt;h:body&gt;
      &lt;ui:composition template="/template/masterlayout.xhtml"&gt;
          &lt;p:dataTable id="&lt;ui:insert name='gridId' /&gt;" var="rpb"
              value="#{&lt;ui:insert name='bean' /&gt;.&lt;ui:insert name='list' /&gt;}"&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h3&gt;&lt;ui:insert name='title' /&gt;&lt;/h3&gt;
              &lt;/f:facet&gt;
  
              .....
  
              &lt;f:facet name="footer"&gt;
                  #{fn:length(&lt;ui:insert name='bean' /&gt;.&lt;ui:insert name='list' /&gt;)} records&lt;br /&gt;
              &lt;/f:facet&gt;
          &lt;/p:dataTable&gt;
      &lt;/ui:composition&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And here's one of the facelet that makes use of the grid template :</p>
  
  <pre><code>&lt;ui:composition template="gridTemplate.xhtml"&gt;
      &lt;ui:define name="gridId"&gt;grid&lt;/ui:define&gt;
      &lt;ui:define name="bean"&gt;myBean&lt;/ui:define&gt;
      &lt;ui:define name="list"&gt;myList&lt;/ui:define&gt;
      &lt;ui:define name="title"&gt;my message !&lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>And this experiment ends up with :</p>
  
  <pre><code>javax.servlet.ServletException: Error Parsing /gridTemplate.xhtml: Error Traced[line: 17] The value of attribute "id" associated with an element type "null" must not contain the '&lt;' character.
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
  
  root cause
  
  javax.faces.view.facelets.FaceletException: Error Parsing /gridTemplate.xhtml: Error Traced[line: 17] The value of attribute "id" associated with an element type "null" must not contain the '&lt;' character.
      com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:394)
      com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:368)
      com.sun.faces.facelets.compiler.Compiler.compile(Compiler.java:124)
      com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:297)
      com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(DefaultFaceletFactory.java:92)
      com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:162)
      com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:161)
      com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(DefaultFaceletCache.java:83)
      com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(DefaultFaceletCache.java:79)
      com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:99)
      java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      java.util.concurrent.FutureTask.run(FutureTask.java:138)
  </code></pre>
  
  <p>I assume that this approach is not plausible, hence there should be a better solution for this kind of needs.</p>
  
  <p>Should i use JSF Facelet Tag or JSF Composite Tag for this kind of case ?</p>
  
  <p>Please share your opinions .. Thank you !</p>