Context: Each half-inning formally starts when the umpire calls "Play" or "Play ball". A full inning consists of six outs, three for each team; and, in Major League Baseball and most other adult leagues, a regulation game consists of nine innings. The visiting team bats in the first half-inning, the top of the inning, derived from the position of the visiting team at the top line of a baseball line score. The home team's half of an inning is the bottom of the inning, and the break between halves of an inning is the middle of the inning. If the home team is leading in the middle of the final scheduled inning, or scores to take the lead in the bottom of the final scheduled inning, the game immediately ends in a home victory.

Question: who bats in the top of the inning?
Steam of consciousness below:
To answer the question, consider the following: The visiting team bats in the first half-inning, the top of the inning, derived from the position of the visiting team at the top line of a baseball line score.
So, the answer is The visiting team.