The Scottish National Party has been mired in splits and controversy in recent weeks over accusations against the leadership that it had not been effective in combatting anti-transgender sentiment among top politicians.