On Tue, Apr 29, 2014 at 6:19 PM, Jonathan Moules <
[email protected]> wrote:

> Hi List,
> I'm wondering about using spaces (" ") in labels.
>
> I'm trying to form a label of two concatenated properties, with the output
> looking like:
>
> *Property1 (Property2)*
>
>>             <se:Label>
>>               <ogc:Function name="Concatenate">
>>                 <ogc:PropertyName>NAME</ogc:PropertyName>
>>                 <ogc:Literal> (</ogc:Literal>
>>                 <ogc:PropertyName>ELEC_2020</ogc:PropertyName>
>>                 <ogc:Literal>)</ogc:Literal>
>>               </ogc:Function>
>>             </se:Label>
>
>
> But the output of that is:
> *Property1(Property2)*
>
> Note the lack of space character before the "(". I tried using "&nbsp;",
> but that resulted in an exception.
>
> After more testing, I ended up at the extreme end:
>
>>             <se:Label>
>>               <ogc:Function name="Concatenate">
>>                 <ogc:PropertyName>NAME</ogc:PropertyName>
>>                 <ogc:Literal>     - - - - - (</ogc:Literal>
>>                 <ogc:PropertyName>ELEC_2020</ogc:PropertyName>
>>                 <ogc:Literal>)</ogc:Literal>
>>               </ogc:Function>
>>             </se:Label>
>
>
> The output of which is:
>  *Property1*- - - - - *(Property2)*
> Again, note the lack of space between Property1 and the first non-space
> character.
>
> Is this meant to happen, am I doing something wrong, or is it a bug? I
> know in HTML it will only ever show a single space character unless they're
> declared explicitly with "&nbsp;" irrespective of how many are in the code,
> but this seems to be left-trimming only.
>

Meant to happen, by SLD spec, we have to eat away the spaces.
All you can do to preserve them is to wrap them in a CDATA section:

             <se:Label>
              <ogc:Function name="Concatenate">
                <ogc:PropertyName>NAME</ogc:PropertyName>
                <ogc:Literal><![CDATA[ (]]></ogc:Literal>
                <ogc:PropertyName>ELEC_2020</ogc:PropertyName>
                <ogc:Literal>)</ogc:Literal>
              </ogc:Function>
            </se:Label>

The CDATA trick should work with SLD 1.0, with SLD 1.1, not sure

Cheers
Andrea


-- 
==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to