Leaf surfaces are dotted with openings called stomata, which act rather like pores. In most plants there are more on the undersides of the leaves than on the top. The stomata are bordered by guard cells that open and close the pore. Transpiration happens when the guard cells open the stomata. This lets oxygen and water vapour flow out, and carbon dioxide flow in. The carbon dioxide is used in photosynthesis, and the oxygen is produced by photosynthesis.