|
|
Issue Type:
|
New Feature
|
Assignee:
|
Jody Garnett
|
Components:
|
main
|
Created:
|
22/Apr/14 12:40 PM
|
Priority:
|
Major
|
Reporter:
|
Andrea Aime
|
|
A new stringTemplate function that receices up to 4 arguments:
-
the first, mandatory, is the input string
-
the second, mandatory, would be a regular _expression_, including potential matching groups
-
the third, mandatory, would be a template using the matched value and matching groups to be expanded, {0}
would represent the full matched string, {1} the first matching group, {2} the second, and so on * the last, optional, would be a default return value in case there is no match, if missing, the function would return null The main use case for this would be to extract bits of complex strings for processing or labeling purposes. Say for example that I have an attribute that is formatted as an ISO string, and I want to extract only the hour portion of it for labeling, the call would be:
<ogc:Function name="template"> <ogc:PropertyName>myAttribute</ogc:PropertyName> <ogc:Literal>\d{4}-\d{2}-\d{2}T(\d{2}):\d{2}:\d{2}</ogc:Literal> <ogc:Literal>{1}
</ogc:Literal> </ogc:Function>
template(myAttribute, '\d {4}
-\d {2}-\d{2}
T(\d {2}):\d{2}
:\d {2}
', {1}
)
|
|
|
|