I'm interested in creating a single SLD that could be used for a layer group in GeoServer that contains layers in point, line and polygon shapes.
According to the documentation it says:
"GeoServer supports the use of a StyledLayerDescriptor document containing a single < NamedLayer > element, which contains a single < UserStyle > element to specify the styling."
and then:
"A Style Layer Descriptor is a StyledLayerDescriptor document containing any number of < NamedLayer > and elements, each of which may contain any number of < UserStyle > or < NamedStyle > elements."
This seems to imply that I could use a single SLD for all my layers. I have created a SLD with multiple < NamedLayer >. However, only the first is being interpreted by GeoServer:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>SAMPLE_EP_1</Name>
<UserStyle>
<Title>SAMPLE_EP_1</Title>
<FeatureTypeStyle>
<Rule>
<Title>SAMPLE_EP_1</Title>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#5D8A82</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
<NamedLayer>
<Name>SAMPLE_EP_2</Name>
<UserStyle>
<Title>SAMPLE_EP_2</Title>
<FeatureTypeStyle>
<Rule>
<Title>SAMPLE_EP_2</Title>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#5D8A82</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
<NamedLayer>
<Name>SAMPLE_EP_3</Name>
<UserStyle>
<Title>SAMPLE_EP_3</Title>
<FeatureTypeStyle>
<Rule>
<Title>SAMPLE_EP_3</Title>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">1.0</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#FF69B4</CssParameter>
<CssParameter name="stroke-width">1.0</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
<NamedLayer>
<Name>SAMPLE_EP_4</Name>
<UserStyle>
<Title>SAMPLE_EP_4</Title>
<FeatureTypeStyle>
<Rule>
<Title>SAMPLE_EP_4</Title>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#BFFFCD
</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#BFFFCD</CssParameter>
<CssParameter name="stroke-width">1.0</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>