Open topic with navigation

# 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).

The style sheet options are enumerated in `KVXMLStyleSheetType`.

## Use Extensible Style Sheet Language (XSL)

You can use XSL style sheets to specify how XML data is displayed in a browser. Existing XSL style sheets can be used, 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 `eStyleSheetType` to `XML_XSL` to enable XSL style sheet mapping.

2. Set `bUseExistingStyleSheet` to `TRUE` to apply a pre-existing style sheet to an XML document. Pre-existing style sheets are not validated.

3. Specify the path and file name of the style sheet file in `pszStyleSheet`.

   If you set `bUseExistingStyleSheet` to `TRUE` and do not specify `pszStyleSheet`, 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.xs` l (for spreadsheets)

   - `pg.xsl` (for presentation graphics)

## Use Cascading Style Sheets (CSS)

In addition to XSL style sheets, Export can write style sheet information to an external CSS file. The C sample program `xmlini` provides an example of how to use an existing style sheet, and output formatting data to an external file. See xmlini.

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

1. Set `eStyleSheetType` to `XML_CSS`.

2. Use the `KVXMLSetStyleSheet()` function to set the path and file name of the external style sheet. KVXMLSetStyleSheet().

To enable CSS mapping and use an existing CSS file

1. Set `eStyleSheetType` to `XML_CSS`.

2. Set `bUseExistingStyleSheet` to `TRUE` to specify a pre-existing style sheet for an XML document.

3. Specify the path and file name of the style sheet file in `pszStyleSheet`.

   If you set `bUseExistingStyleSheet` to `TRUE` and do not specify `pszStyleSheet` or `SetExternalStyleFile`, a CSS style sheet is created.

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

© 2006-2018 EntIT Software LLC, a Micro Focus company | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm