What about
driver.findElement(By.xpath("//*[contains(@name,\"template:view:" + number+ ":item:view:1:item:\")]")).clear();
And you probably need the number to be const, that means:
public void testscenario12345(final String number, String text) throws Throwable {