// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-xslt"]
= XSLT
:page-aliases: extensions/xslt.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-xslt
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Transforms XML payload using an XSLT template.
:cq-deprecated: false
:cq-jvm-since: 0.4.0
:cq-native-since: 0.4.0

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##0.4.0## [.badge-key]##Native since##[.badge-supported]##0.4.0##
endif::[]

Transforms XML payload using an XSLT template.

[id="extensions-xslt-whats-inside"]
== What's inside

* xref:{cq-camel-components}::xslt-component.adoc[XSLT component], URI syntax: `xslt:resourceUri`

Please refer to the above link for usage and configuration details.

[id="extensions-xslt-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-xslt[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xslt</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-xslt-additional-camel-quarkus-configuration"]
== Additional Camel Quarkus configuration

To optimize XSLT processing, the extension needs to know the locations of the XSLT templates at build time.
The XSLT source URIs have to be passed via the `quarkus.camel.xslt.sources` property. Multiple URIs can be separated
by comma.

[source,properties]
----
quarkus.camel.xslt.sources = transform.xsl, classpath:path/to/my/file.xsl
----

Scheme-less URIs are interpreted as `classpath:` URIs.

Only `classpath:` URIs are supported on Quarkus native mode. `file:`, `http:` and other kinds of URIs can be used on JVM mode only.

`<xsl:include>` and `<xsl:messaging>` XSLT elements are also supported in JVM mode only right now.

If `aggregate` DSL is used, `XsltSaxonAggregationStrategy` has to be used such as
[source,java]
----
from("file:src/test/resources?noop=true&sortBy=file:name&antInclude=*.xml")
   .routeId("aggregate").noAutoStartup()
   .aggregate(new XsltSaxonAggregationStrategy("xslt/aggregate.xsl"))
   .constant(true)
   .completionFromBatchConsumer()
   .log("after aggregate body: ${body}")
   .to("mock:transformed");
----
Also, it's only supported on JVM mode.

[id="extensions-xslt-configuration-configuration"]
=== Configuration
TransformerFactory features can be configured using following property:
[source,properties]
----
quarkus.camel.xslt.features."http\://javax.xml.XMLConstants/feature/secure-processing"=false
----
[id="extensions-xslt-configuration-extension-functions-support"]
=== Extension functions support
https://xml.apache.org/xalan-j/extensions.html[Xalan's extension functions]
do work properly only when:

1. Secure-processing is disabled
2. Functions are defined in a separate jar
3. Functions are augmented during native build phase. For example, they can be registered for reflection:
[source,java]
----
@RegisterForReflection(targets = { my.Functions.class })
public class FunctionsConfiguration {
}
----

[NOTE]
====
The content of the XSLT source URIs is parsed and compiled into Java classes at build time. These Java classes are the
only source of XSLT information at runtime. The XSLT source files may not be included in the application archive at all.
====


[width="100%",cols="80,5,15",options="header"]
|===
| Configuration property | Type | Default


a|icon:lock[title=Fixed at build time] [[quarkus.camel.xslt.sources]]`link:#quarkus.camel.xslt.sources[quarkus.camel.xslt.sources]`

A comma separated list of templates to compile.
| List of `string`
| 

a|icon:lock[title=Fixed at build time] [[quarkus.camel.xslt.package-name]]`link:#quarkus.camel.xslt.package-name[quarkus.camel.xslt.package-name]`

The package name for the generated classes.
| `string`
| `org.apache.camel.quarkus.component.xslt.generated`

a|icon:lock[title=Fixed at build time] [[quarkus.camel.xslt.features.-features]]`link:#quarkus.camel.xslt.features.-features[quarkus.camel.xslt.features."features"]`

TransformerFactory features.
| `Map<String,Boolean>`
| 
|===

[.configuration-legend]
{doc-link-icon-lock}[title=Fixed at build time] Configuration property fixed at build time. All other configuration properties are overridable at runtime.

