I am using ui:composition this way:
The template file:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html" locale="en">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<ui:insert name="headerExtend"></ui:insert>
</h:head>
<h:body>
<ui:insert name="content"></ui:insert>
</h:body>
</f:view>
</html>
And here is the actual content inserted:
<ui:composition
template="./layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:define name="content">
<h:form>
</h:form>
</ui:define>
</ui:composition>