  Shapovalov elements $\theta _{\beta,m}$ of the classical or quantized
universal enveloping algebra of
  a simple Lie algebra $\mathfrak{g}$ are parameterized by a positive root
$\beta$ and a positive integer $m$. They relate the highest vector of a
reducible Verma module with highest vectors of its submodules. We obtain a
factorization of $\theta_{\beta,m}$ to a product of $\theta_{\beta,1}$ and
calculate $\theta_{\beta,1}$ as a residue of a matrix element of the inverse
Shapovalov form via a generalized Nigel-Moshinsky algorithm. This way we
explicitly express $\theta_{\beta,m}$ of a classical simple Lie algebra through
the Cartan-Weyl basis in $\mathfrak{g}$. In the case of quantum groups, we give
an analogous formulation through the entries of the R-matrix (quantum
$L$-operator) in fundamental representations.
