<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>MS RFC 9: Item tag for query templates</title>
<meta name="date" content="2006/01/05" />
<meta name="author" content="Steve Lime" />
<link rel="stylesheet" href="mapscript.css" type="text/css" />
</head>
<body>
<div class="document" id="ms-rfc-9-item-tag-for-query-templates">
<h1 class="title">MS RFC 9: Item tag for query templates</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Date:</th>
<td>2006/01/05</td></tr>
<tr><th class="docinfo-name">Author:</th>
<td>Steve Lime</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference external" href="mailto:steve.lime&#64;DNR.STATE.MN.US">steve.lime&#64;DNR.STATE.MN.US</a></td></tr>
<tr><th class="docinfo-name">Status:</th>
<td>Adopted</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>MapServer 4.10</td></tr>
</tbody>
</table>
<p>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.</p>
<p>This would involve adding a new &quot;item&quot; tag to the template processor.</p>
<div class="section" id="files-affected">
<h1>Files affected</h1>
<ul class="simple">
<li>maptemplate.c =&gt; add tag processor, update query template processor to use tag processor.</li>
</ul>
</div>
<div class="section" id="backwards-compatabilty-issues">
<h1>Backwards compatabilty issues</h1>
<p>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.</p>
</div>
<div class="section" id="implementation-details">
<h1>Implementation Details</h1>
<p>The &quot;item&quot; tag would have the following properties.</p>
<blockquote>
<ul class="simple">
<li>name: the name of the attribute to be exposed</li>
<li>format: a simple string containing the token(s) $value</li>
<li>nullformat: string to return if value is NULL or empty (length=0)</li>
<li>uc: convert string to upper case</li>
<li>lc: convert string to lower case</li>
<li>substr: perform a perl-like substring operation by providing offset, and optionally length</li>
<li>commify: add commas to a numeric string (12345 would become 12,345)</li>
<li>escape: what type of escaping to do (default is html), permissible values would be html, url, raw</li>
</ul>
</blockquote>
<p>We could add simple case statement support at a later date but the above would more than meet my needs at the momment.</p>
</div>
<div class="section" id="bug-id">
<h1>Bug ID</h1>
<p>1636</p>
</div>
<div class="section" id="voting-history">
<h1>Voting history</h1>
<p>+1: Lime, Morissette, Butler
+0: Gillies, Warmerdam</p>
</div>
</div>
</body>
</html>
