Bug report #17793
Exporting SLD : "ELSE" rule doesn't export, making the style unusable
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||Yes|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||25689|
The "ELSE" rule in rule based symbology is extremely useful. But when exporting to SLD, the rule gets transformed to :
... <se:FeatureTypeStyle> <se:Rule> <se:Name>A regular rule that works well</se:Name> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"> <ogc:Not> <ogc:PropertyIsNull> <ogc:PropertyName>waterway</ogc:PropertyName> </ogc:PropertyIsNull> </ogc:Not> </ogc:Filter> ... </se:Rule> <se:Rule> <se:Name>All other features</se:Name> <!--Parser Error: syntax error, unexpected ELSE - Expression was: ELSE--> ... </se:Rule> ...
So we get that <!--Parser Error...--> block instead of the whole <ofc:Filter> block.
This means that there's no filter for that rule, making it apply to all features, and thus making the map unreadable.
I don't know if SLD allows for something like "ELSE" ? If not, maybe we could just simulate it by using <ogc:Not> filter and putting all other layers conditions in there ? That may be a bit messy for complex rules... but would work well for simple ones, and would be consistent with what we do for rules groups.