Title: Transformer Configuration

This control lets you open an editor to control the various transformations performed by Traction.



Cllick the Edit button to open the Transformer Setup window.

The Transformer Setup Window





This window lets you choose what sets of transformations are applied in the various situations described in the interface.

These transformers have several purposes:



Each of the transformers listed in the Transformer Setup window is a compound transformer. Compound transformers consist of ordered lists of simple transformers and other compound transformers. Administrators can create new simple and compound transformers using the Create and Edit Transformers Window, which you can access by clicking the Edit or New button next to any of the selections. (The Edit button is not available if the currently selected transformer is not editable.)



Note: The standard transformations packaged with Traction can not be edited, but you can create new transformers and edit transformers you have created.

Inspecting and Testing Transformers with the Create and Edit Transformers Window



You can open any editable transformer in the list by clicking the Edit button next to it. Non-editable transformers in the list may still be inspected. For example, to inspect the default transformations applied when the user clicks the Simplify HTML button on the edit form, click the New button next to the selector labeled "Simplifying Content" to open the Create and Edit Transformers view in a new window.



Then choose "Simplify HTML (Standard)" from the list. Note that this transformation is listed as Standard. The Standard transformations are packaged with Traction and can not be modified, so there is no option to save these.



At the top left you see the transformer's display name and its filename underneath, followed by a description of what it does.

In the left column you see a list of all the defined transformers. On the right side are the transformations that are applied by this compound transformer.

If you want to test a transformer, click the Test Transformer button.



This button will be replaced with input and output areas. You can enter some content to transform in the input area.



When you press the Transform Input button, the output will appear in the output area:



You can test any transformer this way.

You can use the pull-down menu in the top-right to visit any defined transformer.



You can use the Delete button to delete any transformer that you have defined. Standard transformers can not be deleted.

Creating New Transformers



Types of Transformers



Traction currently supports creation of three types of transformers.



Creating a New Regular Expression Transformer



To create a new "regex" transformer, choose the Regular Expression Transformer template.



This opens up a new edit form, which you can fill in.



Once you save your changes, its title and filename will appear, it will appear in the list, and you can test it.



If you are connected to the internet, you should be able to follow the link below to the JavaDoc of the Java Regular Expression pattern class. This explains the syntax of the patterns supported by Traction.



Note: Normally the regular expression replacement operation is applied repeatedly until the result contains no more matches. This behavior can be disabled by changing the option below to "no", in which case the regular expression will only be applied once.



Note: It is easy to write a regular expression that always produces output that will match its pattern (depending upon the input). Even when the above option is set to "yes", Traction will not apply such transformations endlessly; it will cease processing without error after a fixed number of iterations.

Creating a New XML/JavaScript Transformer



Traction includes a powerful SGML transformer that evaluates the DOM and allows ECMAScript code with full DOM access to be run on any matching nodes, producing arbitrarily transformed output. Traction includes a number of such scripts (in the lib directory with a .xf extension).

If an additional .xf script is installed in the lib directory, you can create a new transformer to enable it to be called in other compound transformers.

Note: .xf files can not be installed through Traction's web interface. They require access to the computer on which Traction runs.

To create a transformer to wrap an .xf script, choose XML/JavaScript Transformer from the pull-down menu.



The editor will appear. You can type a description and select the .xf script you wish to invoke.



Note: .xf scripts can only be listed in one transformer, so only .xf scripts that have not yet been wrapped in a transformer will be listed in the selector.

Now you can name and save your transformer.



It will then appear in all the lists of transformers.

Creating a New Compound Transformer



Compound transformers let you define a sequence of transformations to be applied in various situations. You can create alternatives to the transformers that are bundled with Traction. You might do this to prevent users from posting certain content or to allow them to post content that is barred by default (like FORM and IFRAME tags).

To create a new compound transformer, choose Compound Transformer from the pull-down menu.



This opens the Compound Transformer template.



You can enter a description for the transformer. Your description will be shown whenever the transformer is selected.

Underneath the description field is a list of all available transformers. Click on a transformer in this list to see its description.

The transformer or transformers that are highlighted in the "Available" selector, click the "add" button. This will copy the highlighted transformers from the "Available" list to the "Selected" list. You can add multiple instances of a transformation. The transformations in the "Selected" list are applied in the order in which they are listed. To move a transformer in this list, highlight it by clicking on it and use the up and down arrows.



When you have completed defining the compound transformer you can save it, test it, and select it in the list of transformers in the Transformer Setup window.



Restoring Factory Settings



If you decide that you want to revert from a customized transformer regimen to the defaults, you can just choose the default value indicated for each selection in the Transformer Setup window.



Since standard transformers can not be edited, resetting each selection to its default value will reestablish the default configuration.

Don't forget to click the Apply button at the bottom of the page to apply your changes.





Attachments:
image1081.gif
image1082.gif
image1083.gif
image1084.jpg
image1085.gif
image1086.gif
image1087.gif
image1088.gif
image1089.gif
image1090.gif
image1091.jpg
image1092.jpg
image1093.gif
image1094.gif
image1095.gif
image1096.jpg
image1097.gif
image1098.gif
image1099.jpg
image1100.jpg
image1101.gif
image1102.gif
Related Articles
referenced by (1)
Article: Doc303 (permalink)
Date: March 22, 2008; 4:23:31 PM Eastern Daylight Time

Author Name: Documentation Importer
Author ID: importer