# Use Style Sheets

XML is a content-based metalanguage designed to structure data. XML does not include information about how a document should be displayed in a browser. To view an XML document in a browser, information about how its displayed must be provided by style sheets. These are coded by using either Cascading Style Sheets (CSS) or Extensible Style Sheet Language (XSL).

## Use Extensible Style Sheet Language (XSL)

You can use XSL style sheets to specify how XML data is displayed in a browser. You can use existing XSL style sheets, but unlike CSS, style sheet information cannot be written to an external XSL file during the conversion.

Both CSS and XSL style sheets can be used to format XML documents. However, XSL can also transform XML documents. For example, list items can be transformed to display in alphabetical order, words can be replaced by other words, or empty elements can be replaced by text.

To use an existing XSL style sheet

1. Set the style sheet type to XSL by using one of the following methods:

   - Use the `setStyleSheetType` method of the `XmlOptionInfo` class to set the option to `XmlExport.STYLESHEET_XML_XSL`.

   - Set the `eStyleSheetType` parameter in a template file to `XML_XSL`.

2. Apply a pre-existing style sheet to the XML document by using one of the following methods:

   - Set the `setUseExistingStyleSheet` method of the `XmlOptionInfo` class to `TRUE`.

   - Set the `bUseExistingStyleSheet` parameter in a template file to `TRUE`.

     NOTE: Pre-existing style sheets are not validated.

3. Specify the path and file name of the external style sheet by using one of the following methods:

   - Use the `setExternalStyleFile(String)` method of the `Export` object.

   - Set the `pszStyleSheet` parameter in a template file.

The external file style sheet is referenced in the XML output by a processing instruction of the form:

    <xml-stylesheet href="style_file" type="text/xsl"?>

If the location of the style sheet is not specified, a default XSL style sheet that is appropriate for the source document type is used. The following are default XSL style sheets:

- `wp.xsl` (for word processing documents)

- `ss.xsl` (for spreadsheets)

- `pg.xsl` (for presentation graphics)

## Use Cascading Style Sheets (CSS)

In addition to XSL style sheets, XML Export can write style sheet information to an external CSS file.

NOTE: Cascading style sheets can be used only with word processing documents.

To enable CSS mapping and output the resulting formatting data in an external file

1. Set the style sheet type to CSS by using one of the following methods:

   - Use the `setStyleSheetType` method of the `XmlOptionInfo` class to set the option to `XmlExport.STYLESHEET_XML_CSS`.

   - Set the `eStyleSheetType` parameter in a template file to `XML_CSS`.

2. Specify the path and file name of the external style sheet by using one of the following methods:

   - Use the `setExternalStyleFile(String)` method of the `Export` object.

   - Set the `pszStyleSheet` parameter in a template file.

To enable CSS mapping and use an existing CSS file

1. Set the style sheet type to CSS by using one of the following methods:

   - Use the `setStyleSheetType` method of the `XmlOptionInfo` class to set the option to `XmlExport.STYLESHEET_XML_CSS`.

   - Set the `eStyleSheetType` parameter in a template file to `XML_CSS`.

2. To apply a pre-existing style sheet to an XML document, use one of the following methods:

   - Set the `setUseExistingStyleSheet` method of the `XmlOptionInfo` class to `TRUE`.

   - Set the `bUseExistingStyleSheet` parameter in a template file to `TRUE`.

     NOTE: Pre-existing style sheets are not validated.

3. Specify the path and file name of the external style sheet by using one of the following methods:

   - Use the `setExternalStyleFile(String)` method of the `Export` object.

   - Set the `pszStyleSheet` parameter in a template file.

The external file style sheet is referenced in the XML output by a processing instruction of the form:

    <xml-stylesheet href="style_file" type="text/css"?>

If `bUseExistingStyleSheet` or `setUseExistingStyleSheet` is `TRUE`, but the location of the style sheet is not specified, a CSS style sheet is created.

© Copyright 2006-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm