# FindLibXslt

Finds the XSL Transformations, Extensible Stylesheet Language Transformations (XSLT) library (libxslt):

    find_package(LibXslt [<version>] [...])

## Imported Targets

Added in version 3.18.

This module provides the following Imported Targets:

`LibXslt::LibXslt`

  Target encapsulating the usage requirements of the libxslt library. This target is available only if libxslt is found.

`LibXslt::LibExslt`

  Target encapsulating the usage requirements for the libexslt library. Part of the libxslt package, libexslt provides optional extensions to XSLT on top of libxslt. This target is available only if the main libxslt library is found.

`LibXslt::xsltproc`

  Target encapsulating the command-line XSLT processor (`xsltproc`). This tool, part of the libxslt package, applies XSLT stylesheets to XML documents as a command-line alternative to the libxslt library. This target is available only if the `xsltproc` executable is found.

## Result Variables

This module defines the following variables:

`LibXslt_FOUND`

  Added in version 3.3.

  Boolean indicating whether (the requested version of) libxslt was found.

`LibXslt_VERSION`

  Added in version 4.2.

  The version of libxslt found.

`LIBXSLT_LIBRARIES`

  Libraries needed to link to libxslt.

`LIBXSLT_DEFINITIONS`

  Compiler switches required for using libxslt.

`LIBXSLT_EXSLT_LIBRARIES`

  Libraries needed when linking against the exslt library. These are available and needed only when using exslt library.

## Cache Variables

The following cache variables may also be set:

`LIBXSLT_INCLUDE_DIR`

  Directory containing `libxslt/xslt.h` and other libxslt header files.

`LIBXSLT_EXSLT_INCLUDE_DIR`

  Added in version 3.18.

  Directory containing `libexslt/exslt.h` and other exslt-related headers. These are needed only when using exslt (extensions to XSLT).

`LIBXSLT_XSLTPROC_EXECUTABLE`

  Full path to the XSLT processor executable `xsltproc` if found. This path is optional.

## Deprecated Variables

The following variables are provided for backward compatibility:

`LIBXSLT_FOUND`

  Deprecated since version 4.2: Use `LibXslt_FOUND`, which has the same value.

  Boolean indicating whether (the requested version of) libxslt was found.

`LIBXSLT_VERSION_STRING`

  Deprecated since version 4.2: Superseded by the `LibXslt_VERSION`.

  The version of libxslt found.

## Examples

Finding libxslt library and linking it to a project target:

    find_package(LibXslt)
    target_link_libraries(foo PRIVATE LibXslt::LibXslt)

When project also needs the extensions to XSLT (exslt) library, both targets should be linked:

    find_package(LibXslt)
    target_link_libraries(foo PRIVATE LibXslt::LibXslt LibXslt::LibExslt)

Example, how to use XSLT processor in a custom command build rule:

    find_package(LibXslt)

    if(TARGET LibXslt::xsltproc)
      # Executed when some build rule depends on example.html.
      add_custom_command(
        OUTPUT example.html
        COMMAND LibXslt::xsltproc -o example.html transform.xslt example.xml
      )
    endif()