I understood the problem. I simplified the above example but I was also including composite components the following way:
index.xhtml
<ui:composition template="/WEB-INF/templates/layout.xhtml"
...
xmlns:myapp="http://myapp.com/jsf/core">
myapp composite
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui">
...
Unfortunately, one of the composite file in myapp
was declaring an XML prolog. For a reason I don't understand, the use of a composition declaring an XML prolog had the effect to add the XML prolog to the main file.