You can create your own XSLT skins to process the XML that ColdFusion generates. You should be familiar with XSLT and CSS programming. This document does not provide general information on writing XSLT transformations or CSS styles. It does provide information about the following areas:
If you specify an XSLT skin by name and omit the .xsl extension, ColdFusion 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 Administrator. When you install ColdFusion, 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 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" skin="http://anywhereOnTheWeb/basic.xsl"> |
Uses the specified URL. |
ColdFusion passes form tag attributes or attribute values that it does not specifically process directly to the XML, as follows:
This passthrough feature lets you create custom versions of any of the following items for your XSLT to process:
ColdFusion 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 filenames 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 uses if you do not specify a skin attribute for an XML format form. Identical to the basic.xsl file. |
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 div and span tags. |
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 validation rules. Used by all skins. |
_formelements.xsl |
Transformation rules for form elements except for those defined using cfformgroup tags. Used by all skins |
_group_type.xsl _group_type_table.xsl _group_type_css.xsl |
Transformation rules for cfformgroup tags. The tag |
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 skin XSL files have several features that you can use when designing and developing your own transformation. They do the following:
Extending basic.xsl cfformgroup and cfformitem support
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.
Add support for cfformgroup and cfformitem types to the basic.xsl
Styling forms by extending the ColdFusion CSS files
Each ColdFusion 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 cfform tag. |
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 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 provides.