There are two phases to the Trinexx battle. In the first phase, you must fight the fire and ice heads that come out of his body. These heads spit fire and ice respectively, but since the ice that is spit out will stick to the floor, it is recommended that the ice head is taken out first. Use the Fire Rod to stun the ice head and the Ice Rod to stun the fire head, and then slash at the heads with your sword. Watch out for the central head, as that can extend out to damage you. It is recommended that you bring a blue potion or a green potion to this battle.
Once the elemental heads have been defeated, Trinexx with reform itself to look more like a snake with a flashing segment. Other than following you around, Trinexx doesn't have any other attacks in this phase. After a few slashes at that segment, Trinexx will explode, and the seventh crystal containing Princess Zelda is all yours!