<PolyStyle>
style elements are not valid outside the context of a parent <Style>
element. A feature (e.g. Placemark) cannot refer to a PolyStyle element directly but via a Style or StypeMap reference or inlined element. Also, use the proper KML namespace URL as http://www.opengis.net/kml/2.2
rather than http://earth.google.com/kml/2.2
.
Instead rewrite the "style.kml" file like this:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Style Test</name>
<Style id="s1">
<PolyStyle>
<color>776d8f77</color>
<outline>0</outline>
</PolyStyle>
</Style>
<Style id="counties">
<PolyStyle>
<color>776d8f77</color>
<outline>0</outline>
</PolyStyle>
</Style>
</Document>
</kml>
Now a reference to the style will work:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>Viburnum australe US Distribution</name>
<styleUrl>style.kml#counties</styleUrl>
<Polygon>....
Google provides an example of a KML document of styles used by other KML files:
http://kml-samples.googlecode.com/svn/trunk/kml/Style/styles.kml
http://kml-samples.googlecode.com/svn/trunk/kml/Style/remote-style.kml