correct way to calculate transport through a section in an ocean numerical model
I have been using the routines in nctoolbox (also check here) that do all the slicing (vertical, horizontal, following a track).
The repository is in GitHub.

The one you should looking at is vsliceg.m.

You can follow the logic there or develop your own.