Is possible to have a style class and script function in section head /head where the style class and script function is defined in xhtml file that is included in another xhtml file. Here an example:
File template.xhtml
<h:body>
<ui:insert name="content" >
Template content
</ui:insert>
</h:body>
File content.xhtml
<ui:composition template="template.xhtml">
<h:outputScript target="head">
function contentJS()
{
}
</h:outputScript>
<ui:define name="content">
<ui:include src="subcontent.xhtml"/>
</ui:define>
</ui:composition>
File subcontent.xhtml
<ui:composition ...>
<h:outputScript target="head">
function subcontentJS()
{
}
</h:outputScript>
<style>
.mystyleclass {color:red}
</style>
<div class="mystyleclass">Text color red</div>
</ui:composition>
In the result xhtml, i have only one javascript funtion and not the two javascript function (contentJS and subcontentJS) and mystyleclass not is in the head section.