This section provides information to help you create your own XSLT skins to process the XML that ColdFusion MX generates. It assumes that you are familiar with XSLT and CSS programming, and does not provide general information on writing XSLT transformations or CSS styles. It does provide information about the following areas:
cfformgroup
and cfformitem
tag type
attributes
If you specify an XSLT skin by name and omit the .xsl suffix, ColdFusion MX looks for the file in the cfform
script source directory and its subdirectories. You can specify the script source directory in your cfform
tag scriptsrc
attribute, and you can set a default location on the Settings page in the ColdFusion MX Administrator. When you install ColdFusion MX, the default location is set to /CFIDE/scripts/ (relative to the web root).
You can also use a relative or absolute file path, or a URL, to specify the XSLT skin location. ColdFusion MX uses the CFML page's directory as the root of relative paths. The following formats are valid:
Format | Location |
---|---|
<cfform format="xml" skin="basic"> |
Searches for XML/CSS in the default directory and its subdirectories. |
<cfform format="xml" skin="c:\foo\bar\basic.xsl"> |
Uses the absolute path. |
<cfform format="xml" skin="basic.xsl"> |
Searches in the current directory. |
<cfform format="xml" skin="..\basic.xsl:"> |
Searches the parent of the current directory. |
<cfform format="xml" |
Uses the specified URL. |
Note: Hosting companies might move the default skin location folder out of CFIDE; this lets them secure the CFIDE while giving site developers access to the files that you need for cfform
.
ColdFusion passes form tag attributes or attribute values that it does not specifically process directly to the XML, as follows:
cfformitem
and cfformgroup
type
attributes to xf:group
element appearance
attributes.
cf:attribute
elements.
This passthrough feature lets you create custom versions of any of the following items for your XSLT to process:
cfformitem
types, such as rules, spacers, or other display elements
cfgroup
types, such as divided boxes or tabbed dialog boxes
cfinput
types, such as a custom year chooser element
ColdFusion MX 7 provides basic XSLT transforms that you can use as templates and extend for making your own skin. Each skin has a base XSL file, which include several utility XSL files. Utility file names start with an underscore (_), and the files are shared by multiple base skins. The following tables describes the XSL files, which are located in the cf_webroot\CFIDE\scripts\xsl directory:
File | Description |
---|---|
default.xsl |
The default transform that ColdFusion MX uses if you do not specify a |
basic.xsl |
A basic form format that arranges form elements using a table. |
basiccss.xsl |
A basic form format that arranges form elements using HTML |
colorname.xsl |
A basic form format that arranges form elements using a table and applies a color scheme determined by the colorname to the form. Based on the basic.xsl file. |
_cfformvalidation.xsl |
Applies ColdFusion MX validation rules. Used by all skins. |
_formelements.xsl |
Transformation rules for form elements except for those defined using |
_group_type.xsl _group_type_table.xsl _group_type_css.xsl |
Transformation rules for |
All skins support the same set of CFML tags and tag types, and do a relatively simple transformation from XML to HTML. For example, they do not support horizontal or vertical rules.
The ColdFusion MX skin XSL files have several features that you can use when designing and developing your own transformation. They do the following:
cfformgroup
and cfformitem
type
attributes by including additional XSL files.
The following procedure describes the steps for extending the basic.xsl file to support additional cfformgroup
and cfformitem
types. You can use similar procedures to extend other xsl files.
type
attribute that you want to support, create an xsl:template
element to do the formatting. The element's match
attribute must have the following format:
match="xf:group[@appearance='type_attribute_name']"
For example, to add a panel cfformgroup
type, add an element with a start tag such as the following:
<xsl:template match="xf:group[@appearance='panel']">
cfformgroup
type, your basic.xsl file would include the following lines:
<!-- include groups that will be supported for this skin--> <xsl:include href="_group_vertical_table.xsl" /> <xsl:include href="_group_horizontal_table.xsl" /> <xsl:include href="_group_fieldset.xsl"/> <xsl:include href="my_group_panel.xsl" />
Each ColdFusion MX skinnable form XSL file uses a corresponding CSS style sheet to specify the form style and layout characteristics. The following CSS files are located in the cf_webroot\CFIDE\scripts\css directory:
File | Description |
---|---|
basic_style.css default_style.css |
Provides a plain style for ColdFusion XSL files that use table-based formatting. These files are identical and are used by the basic.xsl and default.xsl transforms. ColdFusion uses the default_style.css if you do not specify a skin in your |
basic2_style.css |
The basic_style with limited positioning changes for use with XSL files that have div-based formatting. Used by the basiccss.xsl transform. |
css_layout.css |
Style specifications for laying out forms that use div-based formatting. Used by the basiccss.xsl transform. |
colorname_style.css |
Used by the color-formatted ColdFusion MX skins. Defines the same classes as basic_style.css, with additional property specifications. |
The ColdFusion XSL files and their corresponding CSS style sheets use classes extensively to format the form. The basic.xsl file, for example, has only one element style; all other styles are class-based. Although the CSS files contain specifications for all classes used in the XSL files, they do not always contain formatting information. The horizontal class definition in basic_style.css, which is used for horizontal form groups, for example, is empty.
You can enhance the style of XML skinnable forms without changing the XSL transform by enhancing the style sheets that ColdFusion MX provides.