Imago provides a mechanism to define the transforms a
document must undergo before being presented to a client. Control of those
transforms is defined in the ProcessMap.xml file. In general the process map
defines how the system will process specific requests using the following logic:
- Format is determined by user-agent and may be overridden by the user-format
request parameter.
- The requested URI and format is checked against the
req
records. If the URI and format are matched that req
record
is applied. If the URI and format can not be matched, an attempt is made to match
the URI only. If no match is found the default list is used. URI paths are
relative to the Imago servlet content directory
- The appropriate transform is matched in the transform list. The same matching
algorithm used in step 2 is used here. If no transform can be located a 404 error
is returned.
- Each transformer specified in the transform is examined. Any transformer that
specifies a format that does not match the format to be produced is not applied.
- The format record is retrieved and the proper serializer is produced.
Following is the DTD for ProcessMap.xml :
<!ELEMENT processmap (req+,transform+,formatters)>
<!ELEMENT req EMPTY>
<!ATTLIST req uri CDATA #REQUIRED>
<!ATTLIST req source CDATA #IMPLIED>
<!ATTLIST req transform CDATA #IMPLIED>
<!ATTLIST req format CDATA #IMPLIED>
<!ELEMENT transform (transformer+)>
<!ATTLIST transform name CDATA #REQUIRED>
<!ATTLIST transform default (y) #IMPLIED>
<!ATTLIST transform format CDATA #IMPLIED>
<!ELEMENT transformer EMPTY>
<!ATTLIST transformer uri CDATA #REQUIRED>
<!ATTLIST transformer format CDATA #IMPLIED>
<!ELEMENT formatters (format+)>
<!ATTLIST formatters doctype-public CDATA #IMPLIED>
<!ATTLIST formatters doctype-system CDATA #IMPLIED>
<!ATTLIST formatters encoding CDATA #IMPLIED>
<!ATTLIST formatters indent (yes|no) 'no'>
<!ATTLIST formatters method CDATA #IMPLIED>
<!ATTLIST formatters media-type CDATA #IMPLIED>
<!ATTLIST formatters omit-xml-decl (yes|no) 'no'>
<!ATTLIST formatters standalone (yes|no) 'yes'>
<!ATTLIST formatters version CDATA #IMPLIED>
<!ATTLIST formatters preserve-space (true|false) 'false'>
<!ELEMENT format EMPTY>
<!ATTLIST format name CDATA #REQUIRED>
<!ATTLIST format doctype-public CDATA #IMPLIED>
<!ATTLIST format doctype-system CDATA #IMPLIED>
<!ATTLIST format encoding CDATA #IMPLIED>
<!ATTLIST format indent (yes|no) 'no'>
<!ATTLIST format method CDATA #IMPLIED>
<!ATTLIST format media-type CDATA #IMPLIED>
<!ATTLIST format omit-xml-decl (yes|no) 'no'>
<!ATTLIST format standalone (yes|no) 'yes'>
<!ATTLIST format version CDATA #IMPLIED>
<!ATTLIST format preserve-space (true|false) 'false'>
req element.
Attributes:
uri
- The users requested URI. A regular expression.
source
- The URI to map the users request to (optional - if not specified the
requested URI will be used).
transform
- The tranform to use to transform the document (optional - if not specified the
default transform will be used).
format
- The format(s) that the transform will handle. (optional - if not specified all
formats are assumed to be handled).
Example:
<req uri="/index.xml" transform="imago_index"/>
<req uri="/extension.xml" transform="imago_extension"/>
<req uri="/status.xml" transform="imago_extension" />
<req uri="/rfs.xml" transform="rfs_list" />
transform element.
Attributes:
name
- The name by which this transform is known.
default
- Defines this as the default transform (optional). There must be one and
only one default transform. The last default transform specified will be used.
format
- The formats the transform will produce (optional - if not specified all formats
are assumed to be handled). If no formatter can be located a 404 error is returned.
Formats should be specified as a comma separated list.
Attributes:
uri
- The uri of the stylesheet to apply at this step.
format
- The format for which this stylesheet should be applied. (optional - if not
specified all formats are assumed to be handled). Formats should be specified
as a comma separated list.
Example:
<transform name="imago_index" default="y">
<transformer uri="index.xsl">
</transform>
<transform name="imago_extension">
<transformer uri="extension.xsl">
<transformer uri="index.xsl">
</transform>
<transform name="rfs_list">
<transformer uri="rdf_aggregrate.xsl">
<transformer uri="rdf_standardize.xsl">
<transformer uri="rdf_html.xsl" format="html,xhtml">
</transform>
formatters element.
The formatters element defines the default attribute values for the enclosed
format elements.
Attributes:
name
- The name by which this format is known in the browsers section.
May be overridden on the servlet call by setting user-format header value.
doctype-public
- The public id in the DOCTYPE element.
doctype-system
- The system id in the DOCTYPE element.
encoding
- The character encoding for output.
indent
- (yes|no) If "yes" the transformer may insert spaces to indent the result
(pretty print).
method
- The "method" as specified in the
SerializerFactory.getSerializerFactory(method)
call to create the Serializer.
media-type
- The mime type for output.
omit-xml-decl
- (yes|no) If "yes" do not include the <?xml... > element.
standalone
- (yes|no) If "yes" the document will contain a standalone declaration.
version
- The version of the output (defaults html=4, xml=1).
Example:
<formatters encoding="UTF-8" preserve-space="true" omit-xml-decl="yes" >
-
<format name="html"
doctype-public="-//W3C//DTD HTML 4.0//EN"
doctype-system="http://www.w3.org/TR/REC-html40/strict.dtd"
media-type="text/html"
method="html"
/>
-
<format name="html-loose"
doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/REC-html40/loose.dtd"
media-type="text/html"
method="html"
indent="yes"
/>
-
<format name="smil"
doctype-public="-//W3C//DTD SMIL 1.0//EN"
doctype-system="http://www.w3.org/TR/REC-smil/SMIL10.dtd"
media-type="application/smil"
method="xml"
omit-xml-decl="no"
/>
-
<format name="svg"
doctype-public="-//W3C//DTD SVG 20000303 Stylable//EN"
doctype-system="http://www.w3.org/TR/2000/03/WD-SVG-20000303/"
media-type="image/svg-xml"
method="xml"
omit-xml-decl="no"
/>
-
<format name="text"
media-type="text/plain"
method="text"
/>
-
<format name="vrml"
media-type="model/vrml"
method="text"
/>
-
<format name="xhtml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="xhtml1-strict.dtd"
media-type="text/html"
method="xhtml"
/>
-
<format name="xhtml-loose"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="xhtml1-transitional.dtd"
media-type="text/html"
method="xhtml"
/>
-
<format name="xml"
media-type="text/xml"
method="xml"
omit-xml-decl="no"
/>
-
<format name="wap"
doctype-public="-//WAPFORUM//DTD WML 1.1//EN"
doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"
media-type="text/vnd.wap.wml"
method="xml"
omit-xml-decl="no"
/>
</formatters>