# HG changeset patch # User paulb # Date 1133373763 0 # Node ID 1a1f33a1ee5ac755e1967957b0c6511e87465993 # Parent 82cc476d3215058ae025d7b04f3c76cd8db2f257 [project @ 2005-11-30 18:02:43 by paulb] Added notes about the multiple-choice value label support. diff -r 82cc476d3215 -r 1a1f33a1ee5a docs/reference.html --- a/docs/reference.html Wed Nov 30 18:02:28 2005 +0000 +++ b/docs/reference.html Wed Nov 30 18:02:43 2005 +0000 @@ -54,7 +54,10 @@ involved. Where the optional parameter new is given, the attribute is assumed not to already exist on the element.

Related attributes:

Implementing attributes:

template:multiple-choice-value

This attribute associates the template element on which it is used with an element in the XML document being presented whose purpose is to hold -one of a list of selectable values (as described above).

Example:

<select template:multiple-choice-field="base-system,value" name="...">
<option template:multiple-choice-value="base-system-enum,value,selected" value="..."/>
</select>

This presents the following document fragment:

<base-system value="c">
<base-system-enum value="a"/>
<base-system-enum value="b"/>
<base-system-enum value="c"/>
</base-system>

The output from the combination of the above would be as follows:

<select name="path-to-base-system">
<option value="a">a</option>
<option value="b">b</option>
<option value="c" selected="selected">c</option>
</select>

Syntax:

list-element-name,list-attribute-name,attribute-to-create-when-selected

Related attributes:

Implementing attributes:

template:multiple-choice-list-field

This attribute is similar to template:multiple-choice-field +one of a list of selectable values (as described above).

Example:

<select template:multiple-choice-field="base-system,value" name="...">
<option template:multiple-choice-value="base-system-enum,value,selected" value="..."/>
</select>

This presents the following document fragment:

<base-system value="c">
<base-system-enum value="a"/>
<base-system-enum value="b"/>
<base-system-enum value="c"/>
</base-system>

The output from the combination of the above would be as follows:

<select name="path-to-base-system">
<option value="a">a</option>
<option value="b">b</option>
<option value="c" selected="selected">c</option>
</select>

Values and Labels

Labels different from the actual values employed can be specified using an extra parameter in the annotation:

<select template:multiple-choice-field="base-system,value" name="...">
<option template:multiple-choice-value="base-system-enum,value,selected,text()" value="..."/>
</select>

This +additional parameter is an XPath expression whose context is the +current value-bearing element. The above example selects the text from +inside each base-system-enum element in the modified document fragment presented below.

A modified document fragment providing the labels can be written as follows:

<base-system value="c">
<base-system-enum value="a">A</base-system-enum>
<base-system-enum value="b">B</base-system-enum>
<base-system-enum value="c">C</base-system-enum>
</base-system>

The output from the modified combination would be as follows:

<select name="path-to-base-system">
<option value="a">A</option>
<option value="b">B</option>
<option value="c" selected="selected">C</option>
</select>

Syntax:

list-element-name,list-attribute-name,attribute-to-create-when-selected[,content-expression]

Related attributes:

Implementing attributes:

template:multiple-choice-list-field

This attribute is similar to template:multiple-choice-field except that it associates the template element on which it is used with an element in the XML document being presented containing a list of elements whose values have been selected. This list of selected @@ -65,7 +68,9 @@ in that it associates the template element on which it is used with an element holding a value in a list of selectable values, with the principal difference that potentially many such values may be selected -in this case.

Example:

<select template:multiple-choice-list-field="question-types,question-type-enum,question-type" multiple="multiple">
<option template:multiple-choice-list-value="question-type-enum,question-type,selected" value="..."/>
</select>

This presents the following document fragment:

<question-types>
<question-type-enum question-type="text"/>
<question-type-enum question-type="choice" value-is-set="true"/>
<question-type-enum question-type="special" value-is-set="true"/>
</question-types>

The output from the combination of the above would be as follows:

<select name="path-to-question-types" multiple="multiple">
<option value="text">text</option>
<option value="choice" selected="selected">choice</option>
<option value="special" selected="selected">special</option>
</select>

Syntax:

list-element-name,list-attribute-name,attribute-to-create-when-selected

Related attributes:

Implementing attributes:

template:multiple-choice-list-element

This attribute works in much the same way as template:multiple-choice-list-field except that it does not add a name attribute to the template element on which it is used. The purpose of this attribute, along with template:attribute-list-button, is to provide an alternative approach to presenting lists of selectable values.

Example:

<p template:multiple-choice-list-element="question,question-types,question-type">
...
</p>

See below for an example combining this attribute with the template:attribute-list-button attribute.

Syntax:

element-name|-,list-element-name,list-attribute-name

Here, element-name is the element in the document being presented which contains the selected value elements; if the special value - is given then the context element is the element containing the selected value elements. The list-element-name and list-attribute-name indicate the details of the elements providing the list of selectable values.

Related attributes:

Implementing attributes:

template:attribute-list-button

This attribute works in much the same way as template:attribute-button +in this case.

Example:

<select template:multiple-choice-list-field="question-types,question-type-enum,question-type" multiple="multiple">
<option template:multiple-choice-list-value="question-type-enum,question-type,selected" value="..."/>
</select>

This presents the following document fragment:

<question-types>
<question-type-enum question-type="text"/>
<question-type-enum question-type="choice" value-is-set="true"/>
<question-type-enum question-type="special" value-is-set="true"/>
</question-types>

The output from the combination of the above would be as follows:

<select name="path-to-question-types" multiple="multiple">
<option value="text">text</option>
<option value="choice" selected="selected">choice</option>
<option value="special" selected="selected">special</option>
</select>

Values and Labels

Labels different from the actual values employed can be specified using an extra parameter in the annotation:

<select template:multiple-choice-list-field="question-types,question-type-enum,question-type" multiple="multiple">
<option template:multiple-choice-list-value="question-type-enum,question-type,selected,text()" value="..."/>
</select>

This additional parameter is an XPath expression whose context is +the current value-bearing element. The above example selects the text +from inside each base-system-enum element in the modified document fragment presented below.

A modified document fragment providing the labels can be written as follows:

<question-types>
<question-type-enum question-type="text">Text</question-type-enum>
<question-type-enum question-type="choice" value-is-set="true">Choice</question-type-enum>
<question-type-enum question-type="special" value-is-set="true">Special</question-type-enum>
</question-types>

The output from the modified combination would be as follows:

<select name="path-to-question-types" multiple="multiple">
<option value="text">Text</option>
<option value="choice" selected="selected">Choice</option>
<option value="special" selected="selected">Special</option>
</select>

Syntax:

list-element-name,list-attribute-name,attribute-to-create-when-selected[,content-expression]

Related attributes:

Implementing attributes:

template:multiple-choice-list-element

This attribute works in much the same way as template:multiple-choice-list-field except that it does not add a name attribute to the template element on which it is used. The purpose of this attribute, along with template:attribute-list-button, is to provide an alternative approach to presenting lists of selectable values.

Example:

<p template:multiple-choice-list-element="question,question-types,question-type">
...
</p>

See below for an example combining this attribute with the template:attribute-list-button attribute.

Syntax:

element-name|-,list-element-name,list-attribute-name

Here, element-name is the element in the document being presented which contains the selected value elements; if the special value - is given then the context element is the element containing the selected value elements. The list-element-name and list-attribute-name indicate the details of the elements providing the list of selectable values.

Related attributes:

Implementing attributes:

template:attribute-list-button

This attribute works in much the same way as template:attribute-button does, but instead presents a button or related user interface control whose state reflects the presence of an attribute on an element in a collection of elements.

Example:

<p template:multiple-choice-list-element="question,question-types,question-type">
<input template:attribute-list-button="question-type,checked" name="..." value="..." type="checkbox"/>
</p>

Given an XML document like this...

<question>
<question-types question-type="text" value-is-set="true"/>
<question-types question-type="choice"/>
</question>

...the following would be produced as output:

<p>
<input name="path-to-question-type" value="text" type="checkbox" checked="checked"/>
</p>
<p>
<input name="path-to-question-type" value="choice" type="checkbox"/>
</p>

Syntax:

attribute-name,attribute-to-create-when-set

Related attributes:

Implementing attributes:

Internal Annotations

The special annotations template:expr and template:expr-attr