For all legal purposes is at complete odds with the explicitly written exceptions within the act.
My feeling is that the worst case ruling has to reflect this.
The act also miraculously can identify females when it comes to titles too.
This means that sex and gender reassignment MUST be two different things and gender reassignment CAN NOT replace sex.
If the judge sees this, surely there has to be at least an acknowledgement the law is blatantly incoherent , and falls apart and they have no alternative but to rule that and throw it back to Westminster. That's before you consider the effect of that law on homosexuals and voyeurism laws amongst others.
In that scenario it's then completely out of the hands of the SNP, and Labour have the prospect of dealing with this issue at a time when the polls are screaming that Nigel Farage is likely to break the red wall at the next election. Given the political tides and how this issue featured state side, this would be the hill Labour died on if they decide to screw over women. That's generally not how politicians work when it comes down to it - the desire to stay in power and keep their jobs tends to be motivating.
We shall see, but I don't expect a ruling in favour of the Scottish government without a massive caveat about how the law was fucked up and incoherent. And I honestly believe that's all we need at this point.
And that's where I think the worse case scenario lies.
(I could be wrong but I don't see how).