Unfortunately if the judge directs you to use particular pronouns, and you refuse, then you most certainly can be held in contempt.
I'm A Christian, and would swear on the Bible to tell "the truth, the whole truth, and nothing but the truth". I hope that if I were in the position to be giving evidence I would have the courage to say, "I'm sorry my Lord/Lady if this seems to be disrespectful to the court - I have every respect for the court but I have taken an oath to a higher power to tell the truth.
It is my belief that God created people in two sexes, male and female, and the truth is that the accused is male and therefore should be referred to by the pronouns "he, him and his". In all conscience i cannot refer to this person by female pronouns, because he is physically male".
I would like to see how the judge would reconcile my (legally confirmed) right to the expression of my sincerely held Christian beliefs with the accused's (not legally supported) demand to his (probably recently) adoption of a trans identity. Especially as (if I understand it correctly) this particular area of the Bench Book is advisory, not mandatory.
I hope I'm never in that position - but I'd be very interested to see how such a challenge would play out.