You seem to have picked a serverside script event. Usually you add an OutputScript element and add code like this (off my head might contain typos):
XSP.addOnLoad(function(){
XSP.byId("#{id:loc1}").focus();
});
Does that work for you?
Update
Complete example, works here:
XPage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xc:LayoutSample>
<xp:this.facets>
<xc:focusBaby xp:key="facetMiddle"></xc:focusBaby>
</xp:this.facets>
</xc:LayoutSample>
</xp:view>
Custom control (where you have the named element, the second in my form)
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
One 
<xp:inputText id="inputText1"></xp:inputText>
<xp:br></xp:br>
Two 
<xp:inputText id="inputText2"></xp:inputText>
<xp:br></xp:br>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[XSP.addOnLoad(function(){
XSP.getElementById("#{id:inputText2}").focus();
});]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
What did you do different?