  We critically discuss fragmentation of quark or antiquark to massive
particles (mesons or baryons) in proton-proton collisions. Both heavy and light
quark/antiquark fragmentations are discussed using universal $z$-dependent
fragmentation functions. Different scenarios how to define the $z$ variable are
considered: as a fraction of energy, momentum or light-cone momentum of the
parent quark/antiquark. Also a choice of the direction of motion of hadron with
respect to the parent parton must be made in the simplest approach. Energy and
flavour violation is discussed for the region of small $p_t$ and/or
center-of-mass $y \sim$ 0. Results of different approaches are compared. We
show that at the LHC energies all schemes become consistent for $D$-meson
transverse momenta larger than $2$ GeV. Relations to results from the
literature are made. We present some examples for production of D mesons from
light and charm quarks/antiquarks. Emission with respect to the direction of
motion lowers the cross section of $D$ mesons at larger rapidities compared to
the traditional approach ($y_D = y_{q/\bar q}$). As illustrated here the effect
of using different prescriptions is particularly large at low energies (fixed
target experiments).
