I have Geoserver 2.19.1, using layers from both Postgres and Oracle, in two different workspaces.
Most of the layers are based on identicaly described tables (same fields+datatypes, different content) on both sides, so I have e.g. the layer sdo_test.parcels (oracle) and pg_test.parcels (postgres).
The SLDs that decorate the layers are based on combinations of field (PropertyName) values. I want to use the same SLDs for both layers (many layers, fairly complex), but the obvious problem is that a field name (PropertyName, not referring to its content) is uppercase in oracle and lowercase in postgres.
I have tried the following in a simple SLD, but it does not validate, with Unable to find function if_then_else
:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" 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" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>gr16_subilotsXtra_style</Name>
<UserStyle>
<Title>gr16_subilotsXtra_style</Title>
<FeatureTypeStyle>
<Rule><Name> </Name>
<PolygonSymbolizer>
<Fill><CssParameter name="fill"><ogc:Literal>#330000</ogc:Literal></CssParameter>
<CssParameter name="fill-opacity"><ogc:Literal>0.69</ogc:Literal></CssParameter>
</Fill>
<Stroke><CssParameter name="stroke"><ogc:Literal>#330000</ogc:Literal></CssParameter>
<CssParameter name="stroke-opacity"><ogc:Literal>1</ogc:Literal></CssParameter>
<CssParameter name="stroke-width"><ogc:Literal>2</ogc:Literal></CssParameter>
</Stroke>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>
<!-- <ogc:PropertyName>SRC_ID</ogc:PropertyName> - this is the original setting-->
<!-- and this is what I tried:-->
<ogc:Function name="if_then_else">
<ogc:Function name="PropertyExists">
<ogc:PropertyName>src_id</ogc:PropertyName>
</ogc:Function>
<ogc:PropertyName>src_id</ogc:PropertyName>
<ogc:Function name="if_then_else">
<ogc:Function name="PropertyExists">
<ogc:PropertyName>SRC_ID</ogc:PropertyName>
</ogc:Function>
<ogc:PropertyName>SRC_ID</ogc:PropertyName>
</ogc:Function>
</ogc:Function>
<!-- end of trying -->
</Label>
<Font><CssParameter name="font-size">12</CssParameter></Font>
<Halo>
<Radius>1</Radius>
<Fill><CssParameter name="fill">#FFFFFF</CssParameter></Fill>
</Halo>
<Fill><CssParameter name="fill">#000000</CssParameter></Fill>
<VendorOption name="polygonAlign">mbr</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>