You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/12/03 16:45:04 UTC

(camel-kamelets-examples) branch main updated (9086934 -> db6f198)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git


    from 9086934  Update CustomerBuilder.java
     new 5687c87  Add xslt example
     new db6f198  Add xslt example

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../README.adoc                                    | 20 ++++++++-----------
 jbang/xslt-transform/banks.camel.yaml              | 23 ++++++++++++++++++++++
 jbang/xslt-transform/mystyle.xsl                   | 11 +++++++++++
 jbang/xslt-transform/sample.xml                    |  9 +++++++++
 4 files changed, 51 insertions(+), 12 deletions(-)
 copy jbang/{circuit-breaker => xslt-transform}/README.adoc (66%)
 create mode 100644 jbang/xslt-transform/banks.camel.yaml
 create mode 100644 jbang/xslt-transform/mystyle.xsl
 create mode 100644 jbang/xslt-transform/sample.xml


(camel-kamelets-examples) 02/02: Add xslt example

Posted by da...@apache.org.
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 db6f198d9ed5280caf96d892e04647b312e9adb4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 3 17:44:50 2023 +0100

    Add xslt example
---
 jbang/xslt-transform/README.adoc | 12 ++++++++++++
 jbang/xslt-transform/sample.xml  |  9 +++++++++
 2 files changed, 21 insertions(+)

diff --git a/jbang/xslt-transform/README.adoc b/jbang/xslt-transform/README.adoc
index 78a12c5..b4b7df3 100644
--- a/jbang/xslt-transform/README.adoc
+++ b/jbang/xslt-transform/README.adoc
@@ -40,6 +40,18 @@ Or run with JBang using the longer command line (without installing camel as app
 $ jbang camel@apache/camel run *
 ----
 
+=== Live updates of message transformation
+
+You can do live changes to the stylesheet and see the output in real-time with Camel JBang by running:
+
+[source,bash]
+----
+$ camel transform message --body=file:sample.xml --component=xslt --template=file:mystyle.xsl --pretty --watch
+----
+
+You can then edit the `mystyle.xsl` file, and save the file, and watch the terminal for updated result.
+
+
 
 === Help and contributions
 
diff --git a/jbang/xslt-transform/sample.xml b/jbang/xslt-transform/sample.xml
new file mode 100644
index 0000000..4b3dc7e
--- /dev/null
+++ b/jbang/xslt-transform/sample.xml
@@ -0,0 +1,9 @@
+<hash>
+  <id type="integer">1369</id>
+  <uid>8c946e1a-fdc5-40d3-9098-44271bdfad65</uid>
+  <account-number>8673088731</account-number>
+  <iban>GB38EFUA27474531363797</iban>
+  <bank-name>ABN AMRO MEZZANINE (UK) LIMITED</bank-name>
+  <routing-number>053228004</routing-number>
+  <swift-bic>AACCGB21</swift-bic>
+</hash>
\ No newline at end of file


(camel-kamelets-examples) 01/02: Add xslt example

Posted by da...@apache.org.
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 <cl...@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>