The high importance of X-ray photoelectron spectroscopy (XPS) in surface analysis is well established. In XPS, the shape of the measured peaks is affected by two classes of energy loss: extrinsic losses because of the transport of photoelectrons in the matter and intrinsic losses because of the sudden creation of the static core hole. In order to perform a quantitative, comprehensive determination of the zero-energy loss spectrum, a systematic and physically meaningful background subtraction method must be used. In this paper, we propose a universal analytical expression to model the energy loss cross section of the emitted photoelectrons for transition metals and their oxides. The proposed expression is a generalization of the well-known Tougaard's universal inelastic scattering cross section to also account for the intrinsic losses. We demonstrate the use of this to determine the primary excitation spectra of several transition metals and their oxides, and we compare the results with a more accurate calculation based on the dielectric response model for XPS.