Knowledge Discovery 25.1
Knowledge Discovery Expert

# XSLT in Knowledge Discovery

XSLT (Extensible Stylesheet Language Transformations), is a language for transforming XML documents. XSLT is commonly used to render XML in a human-friendly format (for example HTML), to transform XML into a different type of XML for input (for example, RSS), or even to generate a non-XML format like CSV (comma-separated values) for import into an application like Microsoft Excel. XSLT transforms XML documents using XSLT templates, which are themselves written in XML.

The Knowledge Discovery native API is a REST-style Web service called the ACI (Autonomy Content Infrastructure) API. The default response format is XML, with a Knowledge Discovery-specific schema. All ACI services have the built-in capability to perform server-side XSLT transformations.

NOTE: ACI Servers support only XSLT version 1.0.

TIP: The Knowledge Discovery Admin user interface allows you to perform many administrative actions in Knowledge Discovery without setting up your own XSLT templates. Before you start to use XSLT, check whether the Knowledge Discovery Admin interface contains the functionality you need for your services. For more information, refer to the Knowledge Discovery Admin User Guide.

## Advantages of XSLT

The most obvious benefit of using XSLT templates in Knowledge Discovery is that rendering verbose XML output in a more human-friendly format such as HTML can significantly simplify user interaction. It allows you to filter, restructure, and format the information. You can also embed dynamic links into the rendered HTML to make it easy to issue companion actions (for example, to revoke a license seat after viewing license status). In fact, you can write reasonably complex front-end interfaces to Knowledge Discovery exclusively using XSLT.

Another advantage of using XSLT is that it avoids the complexity and overhead of custom code in Java, .NET, Python, and so on. This can greatly speed up development time, particularly for one-time tools and prototypes.

XSLT does not need to generate HTML.

EXAMPLE: Knowledge Discovery supports the OpenSearch XML standard. Both ACI servers and OpenSearch are based on REST-style Web services, and it is simple to use XSLT to transform Knowledge Discovery responses into OpenSearch-compliant XML responses.

EXAMPLE: You can use XSLT templates to convert Knowledge Discovery statistics into CSV files, which can be imported into charting and analysis tools such as Excel.

Other potential XSLT uses include charting information directly by converting XML output to the SVG format, or converting to the XSL-FO format to generate PDF reports.

## Use XSLT in Knowledge Discovery

To set up XSLT with a Knowledge Discovery ACI service, you need to deploy the `autnxslt` library file in the same directory as the ACI service executable.

NOTE: The specific name of the library file varies according to your platform.

You must also configure the following parameters to enable XSLT in the service:

    [Server]
    XSLTemplates=True

    [Paths]
    TemplateDirectory=PathToXSLTTemplates

When the ACI service starts up, the service logs the following message in the application.log:

    ACI Server is configured for XSLT templating

All subsequent ACI actions support the `Template` action parameter, which allows you to add an appropriate template, as needed, for each action. For example:

    action=GetStatus&Template=GetStatusForm

The template must be in the directory that you specify in the `TemplateDirectory` configuration parameter. You do not need to add the .tmpl extension to the template name in the `Template` parameter.

TIP: You can also optionally add the `ForceTemplateRefresh` parameter to an action to force the ACI service to reload the latest version of the XSLT template file from disk, rather than from the cache. This parameter is useful during configuration and testing of the XSLT.

## Standard Templates

The standard component ZIP packages include a number of templates for Knowledge Discovery actions such as `GetStatus`, `IndexerGetStatus`, `MemoryReport`, `Query`, `GetContent`, and `Suggest`.

The following examples show the `GetStatus` XML output (left) and the output from the `GetStatus` form (right):

Copyright 2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery 25.1

Topic Title: XSLT in Knowledge Discovery