An approximate method for describing the evolution of solitonlike initial conditions to solitons for the sine-Gordon equation is developed. This method is based on using a solitonlike pulse with variable parameters in an averaged Lagrangian for the sine-Gordon equation. This averaged Lagrangian is then used to determine ordinary differential equations governing the evolution of the pulse parameters. The pulse evolves to a steady soliton by shedding dispersive radiation. The effect of this radiation is determined by examining the linearized sine-Gordon equation and loss terms are added to the variational equations derived from the averaged Lagrangian by using the momentum and energy conservation equations for the sine-Gordon equation. Solutions of the resulting approximate equations, which include loss, are found to be in good agreement with full numerical solutions of the sine-Gordon equation.