Variational approach to sensitivity analysis in nonlinear elasticity