===============================================================
  MS RFC 9: Item tag for query templates
===============================================================

:Date: 2006/01/05 
:Author: Steve Lime
:Contact: steve.lime@DNR.STATE.MN.US
:Status: Adopted
:Version: MapServer 4.10

Description: A the moment processing of attributes exposed via query templates is limited to a couple forms of escaping. This is too limiting. It would be much nicer to be able to apply a format to an attribute (e.g. truncate decimals or add a prefix) or detect when it is NULL or empty and present an alternative representation. This RFC describes a simple scheme to allow for extended processing of attributes before sending to the a users.

This would involve adding a new "item" tag to the template processor.

Files affected
~~~~~~~~~~~~~~~~~

- maptemplate.c => add tag processor, update query template processor to use tag processor. 

Backwards compatabilty issues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

N/A, new functionality. Existing methods for exposing an attribute (e.g. [attribute name] would continue to function, although we might mark that as depricated at some point.

Implementation Details
~~~~~~~~~~~~~~~~~~~~~~

The "item" tag would have the following properties.

 - name: the name of the attribute to be exposed
 - format: a simple string containing the token(s) $value
 - nullformat: string to return if value is NULL or empty (length=0)
 - uc: convert string to upper case
 - lc: convert string to lower case
 - substr: perform a perl-like substring operation by providing offset, and optionally length
 - commify: add commas to a numeric string (12345 would become 12,345)
 - escape: what type of escaping to do (default is html), permissible values would be html, url, raw

We could add simple case statement support at a later date but the above would more than meet my needs at the momment.  

Bug ID
~~~~~~~~

1636

Voting history
~~~~~~~~~~~~~~~~~

+1: Lime, Morissette, Butler
+0: Gillies, Warmerdam