Friday, April 18, 2008

Coleman Diesel Camping Stove

Invocation API in a Java method via XSLT

Sometimes, working with XSLT transformation service of Progress, I need to call external Java functions, for example, to extract data from a database to be included in the XML output. Describe below the method that I found.

1) Define a new Java class. I called classeProva, part of the package com.provaluke, and contains the static method metodoProva ().

2) It binds to the service the jar containing the class.

2) In the XSLT file that defines the transformation defining a new namespace (in the next example I called it "luke") where you declare the class with the method you want to use, preferring "java:".

The XSLT file so he will now begin.

\u0026lt;xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" xmlns: docns = "C: \\ Project \\ workingArea \\ SchemaCanonical.xsd" xmlns : luke = "java: com.provaluke.classeProva">

Then, at the appropriate time, the method is invoked by prefixing the namespace as follows:

\u0026lt;xsl:value-of select="luke:metodoProva('1')"/>


course you can also pass arguments, etc.. etc.

0 comments:

Post a Comment