The substitution theorem for semilinear stochastic partial differential equations