Once the decision of having a testes versus an ovary is determined based on
XX versus XY, then that will be the gonadal sex.
So that cannot, ne, sometimes the gonadal sex does not match the chromosomal sex.
So for instance, if the SRY gene is mutated on the Y chromosome,
then an ovary, will form even though the person has a chromosomal
male sex of XY, they can have a gonadal sex that is female.
Once you've established which gonads you're
going to have, the gonad is going to
be the source of hormone which is going to determine your phenotypic sex.
Basically what do you appear to be, and so that
requires that the gonad is producing the proper hormone
and that you have the proper receptors for the hormone
in order to have the correct phenotypic sex based on
the gonadal sex and then based on the chromosomal sex.
So an example of this is that you need the SRY gene so that you can form a testes,
but you also need the testosterone receptor in order to appear to be a male.
Whether or not you have the test normal testes, you still need to be
able to form testosterone and to express
the testosterone receptor to appear, as a male.
So there's many steps that are required in
order to form, properly in terms of gender.