Handle out-of-order and shared Styles and styleUrls in KML

This PR fixes #1600 reported by @oterral (same issue as #1719 reported by @ke5stl).

@oterral, @ke5stl, please can you test this (it works for me, but I'd like for it to get some wider testing).