Just wanted to pop in and mention that Spain et al should only be worried about Scotland staying in the EU if those countries are looking to leave the EU, no? If Scotland go for independence first, and get it, then ok, perhaps some concern, but if they're doing it so they can stay in the EU then Scotland is demonstrating not that it's better to be a small country on their own, but rather a small country that is part of a bigger club.
If Spain wants to leave the EU and then Catalonia pipes up to stay, then, ok, we've set precedence...