Real-time methods
are convenient for simulating core-level absorption
spectra but suffer from nonphysical intruder peaks when using atom-centered
basis sets. In transient absorption spectra, these peaks exhibit highly
nonphysical time-dependent modulations in their energies and oscillator
strengths. In this paper, we address the origins of these intruder
peaks and propose a straightforward and effective solution based on
a filtered dipole operator. In combination with real-time time-dependent
density functional theory (RT-TDDFT), we demonstrate how to compute
intruder-free attosecond transient X-ray absorption spectra for the
aminophenol (C6H7NO) oxygen and nitrogen K-edges
and the α-quartz (SiO2) silicon L-edge. Without filtering,
the computed spectra are qualitatively wrong. This procedure is suitable
for both static and transient inner-shell spectroscopy studies and
can easily be implemented in a range of real-time methodologies.