  We study inclusive production of doubly heavy baryon at a $e^+e^-$ collider
and at hadron colliders through fragmentation. We study the production by
factorizing nonpertubative- and perturbative effects. In our approach the
production can be thought as a two-step process: A pair of heavy quarks can be
produced perturbatively and then the pair is transformed into the baryon. The
transformation is nonperturbative. Since a heavy quark moves with a small
velocity in the baryon in its rest frame, we can use NRQCD to describe the
transformation and perform a systematic expansion in the small velocity. At the
leading order we find that the baryon can be formed from two states of the
heavy-quark pair, one state is with the pair in $^3S_1$ state and in color
${\bf \bar 3}$, another is with the pair in $^1S_0$ state and in color ${\bf
6}$. Two matrix elements are defined for the transformation from the two
states, their perturbative coefficients in the contribution to the
cross-section at a $e^+e^-$ collider and to the function of heavy quark
fragmentation are calculated. Our approach is different than previous
approaches where only the pair in $^3S_1$ state and in color ${\bf \bar 3}$ is
taken into account. Numerical results for $e^+e^-$ colliders at the two
$B$-factories and for hadronic colliders LHC and Tevatron are given.
