  The eclipsing low-mass X-ray binary X1822-371 is the prototype of the
accretion disc corona (ADC) sources. We analyse two Chandra observations and
one XMM-Newton observation to study the discrete features and their variation
as a function of the orbital phase, deriving constraints on the temperature,
density, and location of the plasma responsible for emission lines. The HETGS
and XMM/Epic-pn observed X1822-371 for 140 and 50 ks, respectively. We
extracted an averaged spectrum and five spectra from five selected
orbital-phase intervals that are 0.04-0.25, 0.25-0.50, 0.50-0.75, 0.75-0.95,
and, finally, 0.95-1.04; the orbital phase zero corresponds to the eclipse
time. All spectra cover the energy band between 0.35 and 12 keV. We confirm the
presence of local neutral matter that partially covers the X-ray emitting
region; the equivalent hydrogen column is $5 \times 10^{22}$ cm$ ^{-2}$ and the
covered fraction is about 60-65%. We identify emission lines from highly
ionised elements, and a prominent fluorescence iron line associated with a
blending of FeI-FeXV resonant transitions. The transitions of He-like ions show
that the intercombination dominates over the forbidden and resonance lines. The
line fluxes are the highest during the orbital phases between 0.04 and 0.75. We
discuss the presence of an extended, optically thin corona with optical depth
of about 0.01 that scatters the X-ray photons from the innermost region into
the line of sight. The photoionised plasma producing most of the observed lines
is placed in the bulge at the outer radius of the disc distant from the central
source of $6 \times 10^{10}$ cm. The OVII and the fluorescence iron line are
probably produced in the photoionised surface of the disc at inner radii.
(Abridged)
