KVXMLSetStyleSheet()

This function is called directly and is used to specify the full path and file name of an external Style Sheet (XSL or CSS).

Syntax

BOOL pascal KVXMLSetStyleSheet(
    void    *pContext,
    char    *pszStyleSheetName,
    char    *pszRef);

Arguments

pContext

A pointer to a KeyView Export session that you initialized by calling fpInit().

pszStyleSheetName

A pointer to the full path and file name of the style sheet.

pszUrlRef

A pointer to the URL or file name of style sheet.

Returns

  • If the call is successful, the return value is TRUE.

  • If this call is unsuccessful, the return value is FALSE.

Discussion

  • When the value for eStyleSheetType in KVXMLOptions is set to XML_XSL or XML_CSS, an external style sheet is referenced by a processing instruction of the form:

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

    or

    <?xml-stylesheet href="pszRef" type="text/css"?>
  • If the value for pszStyleSheetName includes the output directory, the href only consists of the file name since the XML output resides in the same directory as the style sheet file.

  • If the value for pszStyleSheetName points to a directory other than the output directory, the href consists of the full path and file name.

  • Style sheet information cannot be written to an external XSL file. XML Export can only reference an existing XSL style sheet.

  • When XML_CSS is specified, a CSS file can be created based on pszStyleSheetName.

  • If the name of the CSS is not specified by using this function, a CSS style file is created with an automatically-generated file name.

  • If this function is used to specify the name of the style file, that file is referenced in the processing instruction.

    • If the CSS file does not exist in the specified location, it is created.

    • If it exists, but is empty, CSS styles are written to it.

    • If the CSS file exists and is not empty, the file is not altered. There is no attempt made to validate the file.

  • If there are multiple calls made to fpConvertStream() or KVXMLConvertFile(), and the name of the style sheet has been set with KVXMLSetStyleSheet, the file name can be disabled by calling KVXMLSetStyleSheet again with the pszStyleSheetName and pszRef set to NULL. The file name can then be set to a different value by calling KVXMLSetStyleSheet with the new file name prior to the next call to fpConvertStream() or KVXMLConvertFile().

  • This function runs in-process or out of process. See Convert Files Out of Process.

  • When converting out of process, this function must be called after the call to KVXMLStartOOPSession() and before the call to KVXMLEndOOPSession(). See KVXMLStartOOPSession() and KVXMLEndOOPSession().

  • On Windows, pszStyleSheetName must be in the local Windows code page.