Specifications

Chapter 16200
How data formatting works
All format files reside in the ServerFormats folder within the Configuration folder. Each server
model has its own subfolder: ASP.Net_Csharp, ASP.Net_VB, ASP_Js, ASP_Vbs, ColdFusion,
JSP, Shared, and UD4-ColdFusion. Each subfolder contains one XML file and multiple HTML
files.
Formats.xml describes all the choices in the Format menu. None and Edit Format List are added
automatically by Dreamweaver.
The folder also contains one HTML file for each currently installed format type. Format types
include
AlphaCase, Currency, DateTime, Math, Number, Percent, Simple, and Trim.
More about the Formats.xml file
The Formats.xml file contains one
<format> tag for each item in the Format menu. Each
<format> tag contains the following mandatory attributes:
file=fileName is the HTML file for this format type, such as "Currency".
title=string is the string that appears in the Format menu, such as "Currency -
default"
.
expression=regexp is a regular expression that matches the dynamic data objects that use this
format. The expression is used to determine what format is currently applied to a dynamic data
object. For example, the expression for the
"Currency - default" format would be
"<%\s*=\s*FormatCurrency\(.*, -1, -2, -2, -2\)\s*%>|<%\s*=\s*DoCurrency\(.*,
-1, -2, -2, -2\)\s*%>"
. The value of the expression attribute must be unique among all
<format> tags in the file; it must be specific enough to guarantee that only instances of this
format match the expression.
visibility=[hidden | visible] indicates whether the value appears in the Format menu.
If the value of
visibility is hidden, the format does not appear in the Format menu.
The
<format> tag can optionally contain additional, arbitrarily named attributes.
Some data formatting functions require an argument,
format, which is a JavaScript object. This
object is the node that corresponds to the
<format> tag in the Formats.xml file. The object has a
JavaScript property for each attribute of the corresponding
<format> tag.
The following example shows the
<format> tag for "Currency - default":
<format file="Currency" title="Currency - default" ¬
expression="<%\s*=\s*FormatCurrency\(.*, -1, -2, -2, -2\)\s*%>|¬
<%\s*=\s*DoCurrency\(.*, -1, -2, -2, -2\)\s*%>"
NumDigitsAfterDecimal=-1 IncludeLeadingDigit=-2 ¬
UseParensForNegativeNumbers=-2 GroupDigits=-2/>
The format type for this format is Currency. The string "Currency - default" appears on the
Format menu. The expression
<%\s*=\s*FormatCurrency\(.*, -1, -2, -2, -
2\)\s*%>|<%\s*=\s*DoCurrency\(.*, -1, -2, -2, -2\)\s*%>
is used to find occurrences
of this format in the users document.
NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, and
GroupDigits are parameters for the Currency format type; they are not required. These
parameters appear in the Parameters dialog box for the
Currency format type. The Parameters
dialog box appears when a user chooses the
Currency format type from the plus (+) menu of the
Edit Format List dialog box. The values that are specified for these parameters are used to define
the new format.