  X-ray absorption spectroscopy measured at the $L$-edge of transition metals
(TMs) is a powerful element-selective tool providing direct information about
the correlation effects in the $3d$ states. The theoretical modeling of the
$2p\rightarrow3d$ excitation processes remains to be challenging for
contemporary \textit{ab initio} electronic structure techniques, due to strong
core-hole and multiplet effects influencing the spectra. In this work we
present a realization of the method combining the density-functional theory
with multiplet ligand field theory, proposed in Haverkort et al.
(https://link.aps.org/doi/10.1103/PhysRevB.85.165113), Phys. Rev. B 85, 165113
(2012). In this approach a single-impurity Anderson model (SIAM) is
constructed, with almost all parameters obtained from first principles, and
then solved to obtain the spectra. In our implementation we adopt the language
of the dynamical mean-field theory and utilize the local density of states and
the hybridization function, projected onto TM $3d$ states, in order to
construct the SIAM. The developed computational scheme is applied to calculate
the $L$-edge spectra for several TM monoxides. A very good agreement between
the theory and experiment is found for all studied systems. The effect of
core-hole relaxation, hybridization discretization, possible extensions of the
method as well as its limitations are discussed.
