Show TOC

 Content FiltersLocate this document in the navigation structure

Use

You use content filters to transform the content, layout, or format of documents when they are requested for display. For example, an XML document can be transformed into an HTML file for display in the browser or into a WML file for display on a handheld device. Similarly, the content of a file can be presented in different formats to serve different purposes and audiences. The same information can be distributed as a news column, a business report, or a text file.

 

Integration

In general, content filters that execute formatting and layout transformations use the publishing pipeline . However, you can have other content filters that do not use the pipeline, for example, a content filter that adds a copyright statement to documents.

The content filters that are provided in CM are read filters, that is, they transform the content of resources from a storage format to a presentation format for display in the browser. However, the publishing pipeline can also work in the opposite direction and apply write filters to data input by the user to store that data in a different format.

 

Prerequisites
  • The publishing pipeline is configured appropriately.
  • XSL and CSS stylesheets that are to be applied by the content filters are available. Depending on the layout and formatting requirements, you can use predefined stylesheets that are provided by CM. You can modify these stylesheets or create new ones.
Features

When a resource is requested for display, CM checks if there are any content filters registered for the resource type in question. If so, the resource is passed to a filter manager that is responsible for initiating the transformation process and applying the correct filter.

 

Filter Managers

CM currently provides three filter managers that manage different types of document transformations:

  • The XSLT filter manager transforms an XML document according to instructions provided in an XSL stylesheet that is specified in a filter definition. The output of this transformation can be fed into a formatter program that renders the document in the desired display format. The formatter program to be used is also specified in the filter definition.This filter manager can use various stylesheets and formatters to render XML documents in the following display formats: HTML, XHTML, WML, PLAIN, VRML, and SVG-XML.
  • The HMTL filter manager transforms the layout and style of an HTML document by applying a cascading stylesheet (CSS) to it. The stylesheet must be specified in a filter definition. The filter manager can also provide a base tag and a URL handler.
  • The HTML stylesheet filter manager is an HTML filter manager without base tag and URL handler properties.

The following table lists the parameters of content filters that can be specified during the configuration. Depending on the filter manager class, some parameters are not relevant.

Content Filter Parameters

Parameter Filter Manager Description

Name

All

Name of the filter.

Extensions

All

Specification of the file name extensions of the resources to which the filter is to be applied.

If you leave this input field empty, the filter is applied to all extensions.

MIME Types

All

MIME types of the resources to which the filter is to be applied.

If you leave this input field empty, the filter is applied to all MIME types.

Paths

All

Specification of a path or path pattern to whose content the filter is to be applied.

If you leave this input field empty, the filter is applied to all paths.

For more information, see Using Placeholders .

Resource Type

All

Resources types on which the filter is to be applied.

Repositories

All

Selection of repositories whose content is to be filtered.

Priority

All

Specification of filter priority.

If multiple filters are applicable to a resource, the priority determines the order in which they are applied. A value of 1 indicates the highest and a value of 99 indicates the lowest priority.

Stylesheet

HTML, XSLT

Specification of the stylesheet to be used by the filter.

Base Tag

HTML

Specification of an HTML base tag that is inserted into the HTML output file.

A base tag specifies the base URL from which all relative links in the document are derived.

Base URL

HTML

Specification of a base URL that is used in combination with the URL Handler Classparameter.

The URL handler can use the base URL to modify documents in an HTML document.

URL Handler Class

HTML

Specification of the Java class implemented by the URL handler used to change the URLs in an HTML document.

For example, such a handler could be written to replace relative URLs with absolute URLs in an HTML file. The URL handler must implement the com.sapportals.wcm.service.pipeline.processor.html.IHtmlUrlHandler interface.

Mime Type

XSLT

Specification of the MIME type of the output document.

Formatter

XSLT

Name of the formatter program to be used for generating the output format rendered in the browser.

For more information on formatter programs, see XSLT Filters .

 

Note

The Extensions, Mime Types and Path parameters are used together. Resources have to correspond to all three parameters in order for the filter to be applied.

The parameters only support one specification. If you want to apply a filter to more than one MIME type, you have to create more than one filter.