3.5nd dnd – Can you apply the combat expertise / deadly defense after a trip attempt?

I have a travel construction sword. Is it legitimate:

Attempt to travel to the full attack modifier.
The trip succeeds.
Free melee attack on a lying target.
Take -2 off attack to activate deadly defense.

Is this correct or the attack -2 applies before the attempt to travel?