The spatial modulation of the XSW field, described by the dynamical theory of X-ray diffraction, undergoes a pronounced change when the sample is scanned through the Bragg condition. Due to a relative phase variation between the incoming and reflected beams, the nodal planes of the XSW field shift by half the XSW period. Depending on the position of the atoms within this wave field, the measured element-specific absorption of X-rays varies in a characteristic way. Therefore, measurement of the absorption (via X-ray fluorescence or photoelectron yield) can reveal the position of the atoms relative to the reflecting planes. The absorbing atoms can be thought of as "detecting" the phase of the XSW; thus, this method overcomes the phase problem of X-ray crystallography.