Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

so if one user had the value “custom” for the toc attribute it would be equivalent to

Code Block
languagexml
<toc ref="custom"/>

and if another user did not have a toc attribute at all it would be equivalent to

Code Block
languagexml
<toc ref="main"/>

Converting Values

Weave will try and guess the type of the value, either the attribute value or the default value, and convert the value to that type, using the same rules that the config file reader uses when initially reading the values from the XML files, and as such there may be times when the conversion is incorrect, for example, if the value of the attribute is “1234” Weave will convert that to the number 1234, for example

Code Block
languagexml
<tag value="${user.number}"/>

would result in the following object

Code Block
languagejson
{tag: {value: 1234}}

If the value is supposed to be a string and not a number then you can override this by appending a colon followed by a format, for example, if the value of the user.number attribute is 1234 but you need tag.value to be a string you can explicitly specify the type of the value like:

Code Block
languagexml
<tag value="${user.number:string}"/>

...

And this is the same but providing a default in case the user does not have a number attribute

Code Block
languagexml
<tag value="${user.number|1234:string}"/>

...