The case threatens to undermine efforts by John Swinney to move away from the controversial gender policies pursued by his ...