Root hair cells absorb minerals and water from the soil.
The water absorbed by the root hair cells passes through the plant in xylem tubes, to then reach the leaves. The energy from the sun is then used to convert water(H2O) into hydrogen (H) and oxygen(O2).
I hope this helps