An innovative procedure has been devised for the processing of X-ray d
iffraction data from thin films and layered samples, using the convent
ional Bragg-Brentano geometry. Conventional phase analysis procedures
always consider the sample as a homogeneous set of crystals with rando
m orientation; this assumption can lead to severe errors when studying
layered samples with thickness less than the penetration depth of the
X-rays. Two effects have been considered: the transparency of the lay
ers, that limits the diffracted intensity, and the absorption of the o
uter layers, that reduces both the incident and the diffracted intensi
ty. Both effects can be described by functions connecting the layer th
ickness and the absorption coefficient of the present phases to the to
tal diffracted intensity. Adopting this strategy, the thickness of eac
h layer and its phase composition can be refined together with the oth
er structural parameters of interest, such as lattice parameters, crys
tallite size, microstrain and preferred orientation. The methodology h
as been tested on samples obtained by physical vapor deposition and by
thermal oxidation of metal surfaces.