Include java function in XSL!?
Does anyone know how I can include a java function in a XSL file?
Thanks in advance
C�dric
hi,
will find something useful at the below mentioned links check out.....
http://www.devx.com/xml/articles/vp0801/vp0801-1.asp
http://xml.apache.org/xalan-j/extensions.html
Similar Messages
-
Hi,
I am trying to call a small java function in XSL but while performing transformation I get following error
"Function not in namespaceError in XPath expression, Function not in namespace"
I am performing following steps:
1. Java class file placed in class path and classpath is set. Java class is a simple file with no main() function. There is only one function called calculate()
2. Defined a namespace in XSL
3. Calling a function from class file in XSL
My XSL looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fib="java:FibonacciNumber"
extension-element-prefixes="fib" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/" >
<xsl:value-of select="fib:calculate(number(.))"/>
</xsl:template>
</xsl:stylesheet>
Can someone please point out what I am missing out here?
Regards,
NitinPlease refer
http://www.devx.com/Java/Article/31675 -
Calling Java Function from XSL
I'm trying something I think is fairly simple and keep getting errors during the process. I'm just trying to parse an XML file and call a java method from a simple java program called HelloWorld using an XSL stylesheet.
I get the following error: Error while parsing XSL file (Extension function namespace should start with 'http://www.oracle.com/XSL/Transform/java/'.). Here is my XSL. I know the oracle namespace is not necessary, it was added due to the error I was receiving:
<?xml version = "1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oracle="http://www.oracle.com/XSL/Transform/java/"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
xmlns:jfctn="com.raytheon.iis.temp.HelloWorld" exclude-result-prefixes="jfctn"
exclude-element-prefixes="oracle redirect"
version='1.0'>
<xsl:template match="/">
<xsl:value-of select="//title"/>
<xsl:value-of select="//author"/>
<xsl:value-of select = "jfctn:hello()"/>
</xsl:template>
</xsl:stylesheet>
Here is my java file:
public class HelloWorld {
public static String hello() {
return "Hello World";
And here is my simple XML file:
<source>
<title>XSL</title>
<author> John
Smith</author>
</source>
Any advice/ideas would be greatly appreciated. Thanks.
JimmyAfter some trials I've come up with a more specific issue regarding this error. Here is my new code that works on a machine that does not have a file called xmlparserv2.jar (In my stack trace I noticed it referring to the oracle.xml.parser.v2 so I'm assuming this file and path setup that refers to this file is the issue). Unfortunately I have other programs that need this file and setup so I was wondering if anyone knew some alternate setup or workaround to resolve this issue.
The following works fine for me using xalan on a server with the most recent jdk 1.4 setup.
Here is the new XSL code similar to the one listed above. The XML is the same as the previous post.
<?xml version = "1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
�xmlns:xalan="http://xml.apache.org/xalan"�
�xmlns:jfctn="xalan://com/raytheon/iis/temp/HelloWorld"
exclude-result-prefixes="jfctn"
�version='1.0'>
<xsl:template match="/">
<xsl:value-of select="//title"/>
<xsl:value-of select="//author"/>
<xsl:value-of select = "jfctn:hello()"/>
</xsl:template>
</xsl:stylesheet>
Here is my transform class
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.*;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.net.URL;
import javax.xml.transform.*;
public class SimpleTransform
public SimpleTransform()
public static void main(String args[])
throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException
TransformerFactory transformerfactory = TransformerFactory.newInstance();
File file = new File("test.xsl");
File file1 = new File("test.xml");
try
URL url = file.toURL();
URL url1 = file1.toURL();
InputStream testXsl = url.openStream();
InputStream testXml = url1.openStream();
Transformer transformer = transformerfactory.newTransformer(new StreamSource(testXsl));
transformer.transform(new StreamSource(testXml), new StreamResult(new FileOutputStream( "test.out")));
System.out.println("************* The result is in test.out *************");
testXsl.close();
testXml.close();
catch(Exception exception)
exception.printStackTrace();
} -
Hi,
I am trying to call a small java function in XSL but while performing transformation I get following error
"Function not in namespaceError in XPath expression, Function not in namespace"
I am performing following steps:
1. Java class file placed in class path and classpath is set. Java class is a simple file with no main() function. There is only one function called calculate()
2. Defined a namespace in XSL
3. Calling a function from class file in XSL
My XSL looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fib="java:FibonacciNumber" extension-element-prefixes="fib" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/" >
<xsl:value-of select="fib:calculate(number(.))"/>
</xsl:template>
</xsl:stylesheet>
Can someone please point out what I am missing out here?
Regards,
NitinLooks like you are using the Xalan convention for java protocol in namespaces.
In Oracle XDK you need to use:
xmlns:fib="http://www.oracle.com/XSL/Transform/java/FibonacciNumber"
Assuming your class is in the default package.
If it is in a package you need the fully qualified name:
xmlns:fib="http://www.oracle.com/XSL/Transform/java/com.foo.FibonacciNumber"
See for example http://www.devx.com/Java/Article/31675/0/page/1
or http://download-east.oracle.com/docs/cd/B14099_11/web.1012/b14033/adx04xsj.htm#i1023310
For more discussion on how hard it is to craft portable functions with Oracle,
see Re: EXSLT implementation
Mik -
How to use standard java functions in a XSLT mapping
Hi All,
I wish to use a standard java function in a XSLT mapping, The issue is either i am giving incorrect namespace which is used to invoke the function or the signature of the function call is incorrect, I have read all the links in http://help.sap.com, and i know <b> one can enhance a XSLT mapping by writing one's own java code and thereby using java standard functions </b>, but the requirement is such that i need to try and use java standard function in XSLT mapping itself.
Please refer to the sample code below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javamap="java:java.lang.String">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="input" select="Title">
<xsl:if test="function-available('javamap:toUpperCase')">
<xsl:value-of select="javamap:toUpperCase($input)"/>
</xsl:if>
Author:<xsl:value-of select="Author"/>
</xsl:template>
</xsl:stylesheet>
error encountered is: Illegal number or type of arguments.
please reply if you have tried a similar scenario in SAP XI.
Thanks & Regards,
VarunHi Varun,
First of all i want to tell you that as per the documentation you can only call the static function inside xslt mapping. Your toUpperCase method is a non static function.
What i am getting is that you have an element called Author and you want to convert its value into uppercase.
you can write your own user defined function which is static.
Signature of your java method :
public static string toUpperCase(String Author,Map inputparam)
try this xslt map.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javamap="java:JavaProgram">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="Author">
<xsl:value-of select="//Author_name"/>
</xsl:param>
<xsl:param name="inputparam" />
<xsl:template match="/">
<Author>
<xsl:if test="function-available('javamap:toUpperCase')">
<xsl:value-of select="javamap:toUpperCase($Author,$inputparam)"/>
</xsl:if>
</Author>
</xsl:template>
</xsl:stylesheet>
Hope this will work.
Thanks and Regards
Vishal Kumar -
Using document function in xsl template - not working in BI Publisher
Hi,
I have a requirement where I need to display the data in one xml file based on the contents of a second xml. I am using Oracle BI Publisher 10.1.3.4.1 and template used for report generation is xsl-fo.
1) ReportData.xml - contains the data xml
2) ReportFilter.xml - contains the display information.
I need to display the tags in the ReportData.xml based on the presence , absence of different tags in ReportFiler.xml
I guess one of the option is to declare 2 datasource as use concatenated datasources. However , I am trying to use the "Document" function that is available in xsl transformation to reference the display xml.
I have tried the different options for using the document function
*1) <xsl:variable name="filterCheck" select="document('ReportFilter.xml')"/>*
Errors out saying : XML-22021: (Error) Error parsing external document: 'Access not allowed : file:/
C:/OracleBI/oc4j_bi/bin/ReportFilter.xml '.
*2) <xsl:variable name="filterCheck" select="document('file:///C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out saying ; Caused by: oracle.xdo.parser.v2.XPathException: Access not allowed : file:/C:/Or
acleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml
*3) <xsl:variable name="filterCheck" select="document('C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out saying : Caused by: java.net.MalformedURLException: unknown protocol: c
at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:153
*4)<xsl:variable name="filterCheck" select="document('file:/C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out syaying : Caused by: oracle.xdo.parser.v2.XPathException: Access not allowed : file:/C:/Or
acleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml
I have placed the document I need to access in all the 3 locations mentioned above
ie in my
*1) C folder*
*2) C:/OracleBI/oc4j_bi/bin*
*3) C:/OracleBI/xmlp/XMLP/DemoFiles*
Is there any special permissions that I need to grant to enable access to these files?
Please let me know if anyone has successfully made the document function to reference other xml documents in BI Publisher.
Regards
Sujith
Edited by: user10979469 on Dec 8, 2009 11:48 AMTim,
Thanks a lot for the reply. Set the option to enable external document access and it works perfectly.
Just for other who are looking at this post.
Go to the Report in BI Publisher
Click on Configure link on the top right
Go to the Section FO Processing
Disable external references - Server value is "True" . Set it to "False".
Apply changes.
Restarted the oc4j, just to be on safer side (not sure if this is required)
The document function will open documents from any location on your machine.
Thanks again Tim
Regards
Sujith -
How can I use Seeburger java functions on SAP XI's user defined functions?
Hi All,
As my title implies; how can I use Seeburger java functions on SAP XI's user defined functions? I've tried searching over the net in tutorials regarding this topic but I failed to find one; can someone provide me information regarding my question? thanks very much.
best regards,
MikeHi Mike !
You should check your documentation about which java classes you need to reference in the "import" section of your UDF. And also deploy the java classes into the java stack or include them as a imported archive in integration repository...it should be stated in the seeburger documentation.
What kind of functions are you trying to use?
Regards,
Matias. -
How to call external java functions in XSLT Mapping Programs
Hi All,
I am unable to call java programs in XSLT MAPPING.
I tried by following the blog...but getting error :
XSLT Mapping With JAVA Enhancement ( For Beginners)
I need some input from you all.
Waiting For quick reply.
Rgds Somu.i wrote the code...
and getting error in interface mapping..
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:MyLib="java:datetime.DateandTime">
<xsl:template match="/">
<Order DocType="OrderCreate" Version="2.0.2">
<Header>
<RequestingDocumentIdentifier>
<DocumentIdentifier>
<xsl:value-of select="concat('IDOC',//EDI_DC40/DOCNUM)"/>
</DocumentIdentifier>
</RequestingDocumentIdentifier>
<RequestingDocumentDateTime>
<DateTime DateTimeQualifier="On">
<xsl:if test="function-available('MyLib:getDateValue')">
<xsl:value-of select="MyLib:getDateValue()"/>
</xsl:if>
</DateTime>
</RequestingDocumentDateTime>
<From>
<PartnerInformation>
<PartnerName>BASF SA</PartnerName>
<PartnerIdentifier Agency="AssignedByBASF">
<xsl:value-of select="//E1EDK14[QUALF='014']/ORGID"/>
</PartnerIdentifier>
</PartnerInformation>
</From>
<To>
<PartnerInformation>
<PartnerName>BASF CORP CHEM DIV</PartnerName>
<PartnerIdentifier Agency="D-U-N-S">001307032</PartnerIdentifier>
</PartnerInformation>
</To>
</Header>
</Order>
</xsl:template>
</xsl:stylesheet> -
Java function call from Trigger in Oracle
Moderator edit:
This post was branched from an eleven-year-old long dead thread
Java function call from Trigger in Oracle
@ user 861498,
For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
{end of edit, what follows is their posting}
I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
Trigger:
CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
IS LANGUAGE JAVA
NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
Java:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
// Connect and verify new insert would be a duplicate.
public static void contactTrigger(Integer memberID) throws Exception {
String badgeId;
// Create a Java 5 and Oracle 11g connection.
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
// Create a prepared statement that accepts binding a number.
PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
"FROM Users " +
"WHERE \"User\" = ? ");
// Bind the local variable to the statement placeholder.
ps.setInt(1, memberID);
// Execute query and check if there is a second value.
ResultSet rs = ps.executeQuery();
while (rs.next()) {
badgeId = rs.getString("Note");
// Clean up resources.
rs.close();
ps.close();
conn.close();
// davids badge is 105463705637
EConnection mEngineConnection = new econnection("10.25.10.5",8550);
mEngineConnection.setUserCredentials("choff", "badge00");
mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
Edited by: rukbat on May 31, 2011 1:12 PMTo followup on the posting:
Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
Having figured that out on my own, I minified my code to just run the one line of code:
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
public static void testEkahau(Integer memberID) throws Exception {
try {
EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
} catch (Throwable e) {
System.out.println("got an error");
e.printStackTrace();
}So, after the following:
SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
and the following as the user
SQL> set serveroutput on
SQL> exec dbms_java.set_output(10000);
I run the procedure and receive the following message.
SQL> call java_contact_t4(801);
got an error
java.lang.NoClassDefFoundError
at ThrowAnError.testEkahau(ThrowAnError:13)
Call completed.
NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
creating : resource META-INF/MANIFEST.MF
loading : resource META-INF/MANIFEST.MF
creating : class com/ekahau/common/sdk/EConnection
loading : class com/ekahau/common/sdk/EConnection
creating : class com/ekahau/common/sdk/EErrorCodes
loading : class com/ekahau/common/sdk/EErrorCodes
skipping : resource META-INF/MANIFEST.MF
resolving: class com/ekahau/common/sdk/EConnection
skipping : class com/ekahau/common/sdk/EErrorCodes
skipping : class com/ekahau/common/sdk/EException
skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
skipping : class com/ekahau/common/sdk/EMsg
skipping : class com/ekahau/common/sdk/EMsgEncoder
skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
skipping : class com/ekahau/common/sdk/EMsgProperty
resolving: class com/ekahau/engine/sdk/impl/LocationImpl
skipping : class com/ekahau/engine/sdk/status/IStatusListener
skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
Classes Loaded: 114
Resources Loaded: 1
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 0
Classes skipped: 0
Synonyms Created: 0
Errors: 0
.... with no explanation.
Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
How do i get it to resolve the entire jar file?
Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
Edited by: themadprogrammer on Aug 5, 2011 7:26 AM -
Call Java functions in a C DLL
Hi,
I am develop a dynamic link library in C on AIX that will internally call java functions using JNI. This libaray will be finally used by other C Executable.
There is only one function in C code i.e. Connect. This function internally use JNI and call java functions. Now while compiling I am facing problems. I think that there is some problem with my makefile.
The make file is given hereunder:
JAVA_HOME = /usr/java14
JAVA_INC = $(JAVA_HOME)/include
CC = cc
LD = cc
# Flags to create a dynamic library.
DYNLINKFLAGS = -G -ostdlib -bnoentry -bM:SRE -brtl -bE:Interface.exp
# files removal
RM = rm -f
#------------------------------------- Libs -----------------------------------#
JAVALIBS = -L$(JAVA_HOME)/jre/bin/classic/
LIBS = -ljvm -lpthread -lxnet -lnsl -lm -ldl
#-------------------------------- Dependency rules---------------------------#
# shared library files
LIB_FILES = Interface.a
#-------------------------------------OBJs-------------------------------------#
# shared libraries object files
LIB_OBJS = Interface.o
all: $(LIB_FILES)
# create our librarys
Interface.a: Interface.o
$(LD) $(DYNLINKFLAGS) $(JAVALIBS) $(LIBS) $(LIB_OBJS) -o $@
# compile C source files into object files.
%.o: %.c
$(CC) $(DYNLINKFLAGS) -L$(JAVA_INC) -c $<
# clean everything
clean:
$(RM) $(LIB_OBJS) $(LIB_FILES)
# clean the library's object files only
cleanlibobjs:
$(RM) $(LIB_OBJS)Now the problem is that the size of the Interface.a file is very small only 552 bytes. whereas the size of Interface.o file is 34428. Which clearly indicates that the problem is with the Interface.a file i.e during linking.
Can any body help me to figure out the problem.
Regards,
Ahmad Jalil QarshiI guess, you are better off to ask this question in a C forum. This is a Java forum, you know.
-
Calling JAVA Functions from XSLT
Hi,
I am trying to invoke a Java Extension Function from a XSLT. I added both the class file and the XSLT file to a folder, then zipped the entire folder and uploaded into the Archive for my Interface MApping.
The CLASS gets loaded but the runtime engine gives an error when calling the JAVA Function.
Here is what it says:
Creating mapping sequence with 2 steps. --- Creating Java mapping Deliveries/stringHandler --- Creating mapping sequence with 2 steps. --- Creating XSLT mapping Deliveries/test1 --- Using MappingResolver with context URL /sapmnt/XD1/global/xi/mapping/http%3A%2F%2Fwolterskluwer%2Ecom%2Fxi%2F wk_midas_deliveries%2Ftest/cd2e6820267511d9cb52c3c5143c3524/ --- Loaded class Deliveries.stringHandler --- com.sap.aii.ibrun.server.map.MappingRuntimeException: at com.sap.aii.ibrun.server.map.MappingRuntimeException.code_STYLESHEET_OR_CLASS_NOT_FOUND(MappingRuntimeException.java:91) at com.sap.aii.ibrun.server.map.RUMappingJava.instantiate(RUMappingJava.java:168) at com.sap.aii.ibrun.server.map.RUMappingJava.execute(RUMappingJava.java:41) at com.sap.aii.ibrun.server.map.RUSequence.execute(RUSequence.java:50) at com.sap.aii.ibrun.server.map.RURunner.run(RURunner.java:58) at com.sap.aii.ibrun.server.map.RUManager.run(RUManager.java:66) at com.sap.aii.ibrun.sbeans.map.MappingRequestHandler.handleRequest(MappingRequestHandler.java:67) at com.sap.aii.ibrun.sbeans.map.MappingServiceImpl.processFunction(MappingServiceImpl.java:83) at com.sap.aii.ibrun.sbeans.map.XMappingServiceObjectImpl0.processFunction(XMappingServiceObjectImpl0.java:24) at com.sap.aii.ibrun.sbeans.map.MappingServiceKey.processFunction(MappingServiceKey.java:10) at java.lang.reflect.Method.invoke(Native Method) at com.inqmy.services.rfcengine.RFCDefaultRequestHandler.invokeBean(RFCDefaultRequestHandler.java:83) at com.inqmy.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:50) at com.inqmy.services.rfcengine.RFCJCOServer.handleRequest(RFCJCOServer.java:69) at com.sap.mw.jco.JCO$Server.dispatchRequest(Unknown Source) at com.sap.mw.jco.rfc.MiddlewareRFC$Server.nativeListen(Native Method) at com.sap.mw.jco.rfc.MiddlewareRFC$Server.listen(Unknown Source) at com.sap.mw.jco.JCO$Server.listen(Unknown Source) at com.sap.mw.jco.JCO$Server.run(Unknown Source) at java.lang.Thread.run(Thread.java:513) --
Any help or suggestions to solve this problem would be greatly appreciated.
Thanks
AHi,
Thanks for looking into this.
1. I have verified that the path in the zip file is correct i.e com/sap/test/stringHandler.class
2. test1.xsl is in the root folder i.e No path.
3. I see the Message in the stacktrace saying "Loaded Class com/sap/test/stringHandler.class " but after that I get a runtime MApping Error and it says "CLASS_NOT_FOUND".
Can you please tell me why is this happening?
Thanks
A -
Newbie Help: Calling Java function from XSLT
Hi everyone!
I am trying to call a java function from my XSL file. like...
<xsl:stylesheet version="1.0"
xmlns:java="http://xml.apache.org/xslt/java"
xmlns:fn="http://www.my.com/xslt"
exclude-result-prefixes="java fn">
<xsl:variable name="embeddedpic"
select="formData/instance/EmployeePicture" />
<xsl:variable name="pic" select="fn:com.my.utils.ConversionUtils.base64DecodeString($embeddedpic)"/>I am getting this exception in calling the above java function from my XSLT (XalanXPathException: The function number 'http://xml.apache.org/xslt/java:com.my.utils.ConversionUtils.base64DecodeString' is not available.)I have the function lib file in my classpath but still i am getting this error. Any info is highly appreciated.
ThanksTry this.
<?xml version="1.0" ?>
<xsl:transform version="1.0" xmlns:fn="com.my.utils" >
<xsl:variable name="pic" select="fn:ConversionUtils.base64DecodeString($embeddedpic)"/>
etc.
as long as your code is in the classpath it should find it.
Henock. -
9iAS java functions are not working
Dear All.
Im using oracle 9iAS Release 9.2.0.1.0 and JServer Release 9.2.0.1.0. Im using java functions (eg. Array, pop, push method and trim function) in my JavaScript section.
But these functions are not working. When run the page it work up to that function and stuck. Functions are written properly.
I would be much-appreciated .if you could help me to solve this problem..
Regards,
NishAre you sure you uncommented and changed jvm.include.CLASSPATH=1
in the jvm12.conf when you added your classpath there?
The preferred way to do this would be to create a .war and deploy it instead. Then you can put your beans in the WEB-INF/classes directory and the application wont have conflict problems if you decide to create virtual servers later. -
Using java function in select statement
Hi,
I am trying to use java function in select statement.
public class ClassA{
private static String MyConst = "foo";
public static String functionA(){
return MyConst;
in my query I have:
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
ClassA is part of the application (no need to import).
I get and error of Invalid Expression on ClassA.functionA().
I also tried to declare the function in the processor element:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
<wlevs:processor>
but then I get a different error in the processor XML file: "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
What am I missing here?Hi,
From the above description, you have tried two manners to call method functionA() in the user defined class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
For user defined function manner, I think two things you need to change:
1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
</wlevs:processor>
2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
select A() from myChannel
Regards,
XiYing -
Error using custom xpath function with XSL transformations in BPM
Hi,
We have created a custom xpath function for use with SOA Suite and BPM. This has been built as per specified within the http://docs.oracle.com/cd/E29597_01/dev.1111/e10224/bp_appx_functs.htm#SOASE11100. We have also reviewed the Oracle Sample for mapper-107-ExtensionFunctions (sample demonstrates the use of user-defined extension functions). This has been registered with jDeveloper and SOA within the oracle.soa.ext_11.1.1 (run ant to include in oracle.soa.ext.jar)
We ideally want to use this is BPM within an xsl. However when consuming this function is either BPEL or BPM using an xsl, the xsl fails with an error such as:
XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc("xsl/Transformation_1.xsl", $inputVariable.payload). The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: oramds:/deployed-composites/default/gwCustomXpathUtil_rev1.0/xsl/Transformation_1.xsl<Line 9, Column 113>: XML-22043: (Error) Extension function error: Method not found 'getWeekDayDate'. Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
In an Assign it operates fine and returns the expected result. We have included a combination of both of the Config files (ext-mapper-xpath-functions-config.xml and ext-soa-xpath-functions-config.xml) in the META-INF folder, however neither allow the use of this function in the XSL.
I believe there may be an issue getting the custom xpath functions within XSL files. Hence I have also raised an SR. Has anyone experiences of this?
Our SOA / BPM suite environment is using 11.1.1.6.4 and has the following patches applied:
13801175
14406487 (11.1.1.6.4 SOA Bundle)
13896993
13088538
Regards Dave
Edited by: DavidGaskell on Mar 14, 2013 10:08 PMHi All,
I am also facing the same issue...Experts can you please help us.
hi DavidGaskell, did you find any resolution, if so can you share it with me.....
Thanks,
RR
Maybe you are looking for
-
More Memory or faster processor?
Hi, Im interested in buying a Macbook soon and have a question. Which setup would give me better performance? 1) 2.0GHz Intel Core 2 Duo 2 GB Memory 2) 2.16GHz Intel Core 2 Duo 1GB Memory Everything else is exactly the same. Thanks in advance
-
Dear all, What i need is to calculate the age of an equipment, i have date of birth, in report i need to create a formula and subtract date of birth from sy-datum , however i do not know how to define sy-datum in bex variable or formula variable.. An
-
Very Simple: How do I programmatically add line breaks?
Very Simple: How do I programmatically add line breaks or how do I encapsulate my RichCommandLink's within a paragraph? My Code is as follows: for (String token : userViews.getViewNames()) // add command link RichCommandLink output = new RichCommandL
-
REDO log files lost!!!!!
Hi, I lost my REDO log files, How i can recover??? Thanks Ashish Jain
-
Display Conditions available for end users
I have just created a report with 9 conditions and n number of possible combination of the conditions. I was wondering if it's possible to create some sort of prompt when the user logins to that report so the end user is able to choose the conditions