[Geoserver-users] Question on SLD

Hi,

I have a problem with using CQL in my SLD.

This is my SLD

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="[http://www.opengis.net/sld](http://www.opengis.net/sld) StyledLayerDescriptor.xsd" 
 xmlns="[http://www.opengis.net/sld](http://www.opengis.net/sld)" 
 xmlns:ogc="[http://www.opengis.net/ogc](http://www.opengis.net/ogc)" 
 xmlns:xlink="[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)" 
 xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)">
  <NamedLayer>
    <Name>custom_raster</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Opaque Raster</Title>
          <Abstract>A raster with 100% opacity</Abstract>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <ChannelSelection>
              <RedChannel>
                <SourceChannelName>${env('red',0)}</SourceChannelName>
              </RedChannel>
              <GreenChannel>
                <SourceChannelName>${env('green',1)}</SourceChannelName>
              </GreenChannel>
              <BlueChannel>
                <SourceChannelName>${env('blue',2)}</SourceChannelName>
              </BlueChannel>
            </ChannelSelection>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I call it using ENV=red:1;blue:3;green:5 but I am getting the following message

Caused by: java.lang.IllegalArgumentException: Band number -1 is not valid.
...
Caused by: java.lang.NumberFormatException: For input string: "${env('red',0)}"
...

It doesn’t seem to allow the CQL expressions, at least not where I am placing them… yet doesn’t complain when I validate. Any idea?

Many thanks,

Thomas