This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git
commit 5687c87fd89b287aef27c4cee2238c9e32d11390 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Dec 3 17:12:54 2023 +0100 Add xslt example --- jbang/xslt-transform/README.adoc | 52 +++++++++++++++++++++++++++++++++++ jbang/xslt-transform/banks.camel.yaml | 23 ++++++++++++++++ jbang/xslt-transform/mystyle.xsl | 11 ++++++++ 3 files changed, 86 insertions(+) diff --git a/jbang/xslt-transform/README.adoc b/jbang/xslt-transform/README.adoc new file mode 100644 index 0000000..78a12c5 --- /dev/null +++ b/jbang/xslt-transform/README.adoc @@ -0,0 +1,52 @@ +== XSLT Transformation + +This example shows a basic XML transformation using XSLT style sheet. + +=== Install JBang + +First install JBang according to https://www.jbang.dev + +When JBang is installed then you should be able to run from a shell: + +[source,sh] +---- +$ jbang --version +---- + +This will output the version of JBang. + +To run this example you can either install Camel on JBang via: + +[source,sh] +---- +$ jbang app install camel@apache/camel +---- + +Which allows to run CamelJBang with `camel` as shown below. + +=== How to run + +Then you can run this example using: + +[source,sh] +---- +$ camel run * +---- + +Or run with JBang using the longer command line (without installing camel as app in JBang): + +[source,sh] +---- +$ jbang camel@apache/camel run * +---- + + +=== Help and contributions + +If you hit any problem using Camel or have some feedback, then please +https://camel.apache.org/community/support/[let us know]. + +We also love contributors, so +https://camel.apache.org/community/contributing/[get involved] :-) + +The Camel riders! diff --git a/jbang/xslt-transform/banks.camel.yaml b/jbang/xslt-transform/banks.camel.yaml new file mode 100644 index 0000000..d2652ff --- /dev/null +++ b/jbang/xslt-transform/banks.camel.yaml @@ -0,0 +1,23 @@ +- route: + nodePrefixId: route-ecf + id: route-9e42 + from: + uri: timer + id: from-52f6 + parameters: + timerName: banks + period: '5000' + steps: + - to: + uri: https + id: to-57d1 + parameters: + httpUri: random-data-api.com/api/v2/banks?response_type=xml + - to: + uri: xslt + id: to-8688 + parameters: + resourceUri: mystyle.xsl + - log: + message: ${prettyBody} + id: log-156f diff --git a/jbang/xslt-transform/mystyle.xsl b/jbang/xslt-transform/mystyle.xsl new file mode 100644 index 0000000..b566f59 --- /dev/null +++ b/jbang/xslt-transform/mystyle.xsl @@ -0,0 +1,11 @@ +<?xml version = "1.0"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:template match="/"> + <bank> + <name><xsl:value-of select="/hash/bank-name/text()"/></name> + <bic><xsl:value-of select="/hash/swift-bic/text()"/></bic> + </bank> + </xsl:template> + +</xsl:stylesheet>