  We have investigated the out-of-plane lattice relaxation related to the
ferroelectric transitions in epitaxial BaTiO$_3$ (BTO) films using synchrotron
X-ray diffraction. Under either compressive strain or tensile strain, there is
evidence for two structural phase transitions as a function of temperature. The
transition temperature $T_C$ is a strong function of strain, which can be as
much as 100 K above the corresponding $T_C$ in bulk. Under compressive strain,
the tetragonality of BTO unit cell implies that the polarization of the first
ferroelectric phase is out-of-plane, while under tensile strain, the
polarization is in-plane. The transitions at lower temperature may correspond
to the $aa\to r$ or $c\to r$ transitions, following the notations by Pertsev
\textit{et al}. The orientations of the domains are consistent with theoretical
predictions.
