Hi Andrea,
Thanks for the information.
Alas it doesn't appear to work with SLD 1.1. Is that a spec thing or a
implementation thing? (I tried a quick search in the specs, but "CDATA"
didn't find much of anything in either the 1.0 or 1.1 so I guess it's
defined in some other way).
If the later I'll investigate getting it sponsored as it'll improve our
labelling considerably. :-)
Many thanks,
Jonathan
On 29 April 2014 17:36, Andrea Aime <[email protected]> wrote:
> 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 " ",
>> 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 " " 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
>
> -------------------------------------------------------
>
--
This transmission is intended for the named addressee(s) only and may
contain confidential, sensitive or personal information and should be
handled accordingly. Unless you are the named addressee (or authorised to
receive it for the addressee) you may not copy or use it, or disclose it to
anyone else. If you have received this transmission in error please notify
the sender immediately. All email traffic sent to or from us, including
without limitation all GCSX traffic, may be subject to recording and/or
monitoring in accordance with relevant legislation.
------------------------------------------------------------------------------
"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