<c:set> | Standard JET2 Control Tags
--- | ---

set

Set an attribute on an object selected by an XPath expression. The value of the attribute is determined by the contents of the tag.

If the XPath expression results in more than one object being selected, then that attribute is created on only the first selected object.

If the XPath expression does not select an object, or if the XPath expression is malformed, then an error occurs.

The 'name' attribute need not refer to an attribute defined on the selected object. If the attribute does not exist, one is created dynamically. Such dynamically created attributes are not permanent - they are destroyed when the JET2Context object passed to the template is destroyed.

If the 'name' attribute refers to an existing attribute on the selected object, then the tag attempts to convert the string contents of this tag to the appropriate attribute data type. If this conversion fails, then an error occurs.

Tag Summary
required | <c:set select="value" name="value"> content to be written </c:set>
full tag | <c:set select="value" name="value"> content to be written </c:set>

Required Attributes
select | The XPath expression to evaluate.
name | The name of the attribute to set or create and set.

Example
| <%-- create or update an attribute name-length on element $var --%> <c:set select="$var" name="name-length"> <c:get select="string-length(local-name($var))"/> </c:set>