<xmod:Format>
<xmod:Format> takes a value (typically a [[FieldName]] token) and reformats it for display: numbers and dates get formatted to a culture-aware pattern, text gets String.Format-style placeholder substitution, regular expressions get replaced, and HTML or URL content gets encoded or decoded.
It's a self-closing tag — supply the value via the Value attribute, or place it between the opening and closing tags when the value contains characters that confuse attribute delimiters (single or double quotes).
Example
<xmod:Template ...>
<ItemTemplate>
<!-- Floating-point with leading zero, two decimals: 5 → 05.00 -->
Price (2dp): <xmod:Format Type="Float" Value="[[Price]]" Pattern="0#.00" />
<!-- Whole number, two digits: 5 → 05 -->
Quantity: <xmod:Format Type="Numeric" Value="[[Quantity]]" Pattern="d2" />
<!-- Currency formatted in the server's culture: 5 → $5.00 (US) or £5.00 (UK) -->
Price: <xmod:Format Type="Float" Value="[[Price]]" Pattern="c" />
<!-- Currency forced to UK formatting on every server -->
Price (UK): <xmod:Format Type="Float" Value="[[Price]]" Pattern="c" OutputCulture="en-GB" />
<!-- Date: 04/25/2013 → 04/25/2013 -->
Date: <xmod:Format Type="Date" Value="[[ReleaseDate]]" Pattern="MM/dd/yyyy" />
<!-- Email cloaked from spam bots -->
Contact: <xmod:Format Type="Cloak" Value="[[Email]]" />
</ItemTemplate>
</xmod:Template>Properties
| Property | Values | Default | Description |
|---|---|---|---|
| Type * | Numeric Float Date Text RegEx Cloak HtmlEncode HtmlDecode UrlEncode UrlDecode | What kind of formatting to perform | |
| Value | string | token | The value to format. Alternatively, place between the opening and closing tags | |
| Pattern | format string | Pattern used for Numeric, Float, Date, and RegEx types | |
| Replacement | string | Replacement values used for Text and RegEx types | |
| MaxLength | integer | 0 (no limit) | Truncate the formatted output to N characters and append an ellipsis. Ignored when Type="Cloak" |
| InputCulture | locale id | (current culture) | Culture used to parse Value (e.g. for non-US date formats) |
| OutputCulture | locale id | (current culture) | Culture used to format the output |
* Required property
Property Details
Type: How the value is interpreted and formatted.
Type Value treated as Pattern + Replacement NumericWhole number .NET integer format string ( d,d2,n,c, custom)FloatFloating-point number .NET numeric format string ( 0.00,c,g, custom)DateDate/time .NET date format string ( MM/dd/yyyy,ddd MMM dd yyyy, custom)TextComposite format string with {0},{1}, … placeholdersReplacementis a comma-delimited list of values to fill the placeholdersRegExSubject string for a regex replace Patternis the match regex;Replacementis the replacement (with$1,$2, … back-references)CloakEmail or other string to obfuscate from spam bots (no pattern — uses DNN's CloakTextJavaScript obfuscator)HtmlEncode/HtmlDecodeText to HTML-encode or decode (no pattern) UrlEncode/UrlDecodeText to URL-encode or decode (no pattern) Cloak caveat
Cloakuses inline JavaScript to assemble the value at render time. If JavaScript is disabled, the cloaked text doesn't appear at all. It also can't be used inside amailto:link, since thehrefis parsed before the script runs.Value: The value to format. Either as the
Valueattribute or as the inner content of the tag — useful when the value contains both single and double quotes that would conflict with attribute delimiters.html<xmod:Format Type="Text">[[QuotedField]]</xmod:Format>Pattern: The format pattern. Meaning depends on
Type:Type Pattern is Numeric/FloatA .NET numeric format string — e.g. 0,00,0.00,c(currency),n(number with separators),g(general)DateA .NET date format string — e.g. MM/dd/yyyy,dddd MMMM d, yyyyTextNot used — the placeholders are inside ValueitselfRegExThe regular expression to match in ValueReplacement: Replacement payload. Meaning depends on
Type:Type Replacement is TextComma-delimited list of values that fill {0},{1}, … insideValueRegExThe replacement string for the regex, with $1,$2, … back-referencesother Ignored Text example —
Value="Hello {0}, How's the {1}?",Replacement="John,weather"→"Hello John, How's the weather?"MaxLength: When greater than
0, truncates the formatted output to that many characters and appends.... The ellipsis is included in the count, soMaxLength="10"produces at most 10 characters total. Ignored forCloakbecause truncating obfuscated text can break the unscrambling.InputCulture / OutputCulture: Locale identifiers (e.g.
en-US,fr-FR,de-DE) used when parsing or formatting culture-sensitive values like dates and numbers.Use Example Parse a French-formatted date as input InputCulture="fr-FR"Render currency in UK pounds regardless of server OutputCulture="en-GB"Pattern="c"`Both Take a US date and display it French-style — InputCulture="en-US" OutputCulture="fr-FR"Use
invariantfor culture-neutral formatting.