Original: Both were subsequently elected and Sturgeon led the SNP in the Scottish Parliament from 2004-2007 until Salmond was elected back to the Scottish Parliament in the 2007 election.
Simplified: She became the Deputy Leader of the Scottish National Party in 2004 and because Alex Salmond was still an MP, she was the SNP's leader in the Scottish Parliament until the 2007 Scottish Parliament election.