What is the purpose of xylem in a plant?

The xylem transports water and nutrients from the roots to the leaves.