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
.
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
Set eStyleSheetType
to XML_XSL
to enable XSL style sheet mapping.
Set bUseExistingStyleSheet
to TRUE
to apply a pre-existing style sheet to an XML document. Pre-existing style sheets are not validated.
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)
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
Set eStyleSheetType
to XML_CSS
.
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
Set eStyleSheetType
to XML_CSS
.
Set bUseExistingStyleSheet
to TRUE
to specify a pre-existing style sheet for an XML document.
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.