|
From: Mantas I. <ma...@in...> - 2013-03-24 16:07:33
|
Hi,
I have a requirement to build a label based on conditional expressions, but
I've faced a problem that seems to be a bug in the parser and I can't find
a way to workaround it.
I have a dataset consisting of GIVEN_NAME, SURNAME, COMPANY and
SURVEY_DATE. There can be GIVEN_NAME + SURNAME or COMPANY provided that I
need to display, so it's always eather COMPANY is null or both GIVEN_NAME
and SURNAME are nulls. The problem is that I cannot display GIVEN_NAME and
SURNAME with a whitespace inserted between two, so both attributes appears
merged. It seems that any CDATA whitespace is stripped anyway (tried with
\r\n too) and I think it's a wrong behavior. The SLD snippet I am using is
the following:
<Label>
<ogc:Function name="if_then_else">
<ogc:Function name="isNull">
<ogc:PropertyName>SURNAME</ogc:PropertyName>
</ogc:Function>
<ogc:Function name="if_then_else">
<ogc:Function name="isNull">
<ogc:PropertyName>COMPANY</ogc:PropertyName>
</ogc:Function>
<ogc:Literal>-</ogc:Literal>
<ogc:PropertyName>COMPANY</ogc:PropertyName>
</ogc:Function>
<ogc:Function name="Concatenate">
<ogc:PropertyName>GIVEN_NAME</ogc:PropertyName>
<ogc:Literal><![CDATA[ ]]></ogc:Literal>
<ogc:PropertyName>SURNAME</ogc:PropertyName>
</ogc:Function>
</ogc:Function>
<![CDATA[
]]>
<ogc:Function name="dateFormat">
<ogc:Literal>yyyy-MM-dd</ogc:Literal>
<ogc:PropertyName>SURVEY_DATE</ogc:PropertyName>
</ogc:Function>
</Label>
I have tracked the suspicious condition in the ExpressionDOMParser (line
211-215, version 9.0) that ignores any CDATA whitespace
if (kid.getNodeValue().trim().length() == 0) {
LOGGER.finest("empty text element");
continue;
}
Looking forward to any response.
Mantas
|