I am trying to create a SLD in GeoServer to change the layer style based on the attribute passed. I am using GoeServer Variable substitution. The following is block of my SLD.
<Rule>
<Name>Name</Name>
<Title>Title</Title>
<ogc:Filter>
<ogc:PropertyIsLessThan>
<ogc:Function name="property">
<ogc:Function name="env">
<ogc:Literal>attribute</ogc:Literal>
<ogc:Literal>default_attribute</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Literal>20000</ogc:Literal>
</ogc:PropertyIsLessThan>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#edf8fb</CssParameter>
<CssParameter name="fill-opacity">0.5</CssParameter>
</Fill>
</PolygonSymbolizer>
For example if I am passing the string 'atr1' through environment variable like this.
...&env=attribute:atr1&...
I am getting the exception as follows
The requested Style can not be used with this layer. The style specifies an attribute of [[atr1]] and the layer is: workspace:layer_name
Two square brackets gets added to the string which I passed. If I didn't pass any value for variable, the layer is getting displayed using default attribute. How to avoid those square brackets ?
I am using GeoServer version is 2.10.1