Overloaded Java methods in XSLT extensions?

Hello,
when using Java classes as XSLT extensions, is it possible to use overloaded methods at all? I get "XSL-1042: Extension function error: Overloaded method 'format'" when doing that.
I studied Steve Muench's book, pages 607-611, and came up with the following:
Declared namespaces: "Date" for java.util.Date, "DateFormat" for java.text.DateFormat.
Declared XSL variables: "now" as "Date:new()", "datefmt" as "DateFormat:getDateInstance()".
Value of "Date:toString($now)" works fine. However, value of "DateFormat:format($datefmt, $now)" causes the XSL-1042 error.
Is there any way around this?
--Jere
null

The way around it is to create a wrapper function yourself that doesn't depend on overloading, and then exploit the overloading within your wrapper function call.

Similar Messages

  • How to call Java method from XSLT??

    Hi All,
    Jdev 11.1.1.3.0
    I have a requirement to implement that, I have to call Java method from XSLT. Could anyone please suggest to implement that??
    Thanks,
    Santosh M E

    As pointed by others, you must expose your method as a custom function, registering with JDeveloper (for development time) as well as with SOA Suite (for runtime).
    In the link below you will find a simple step by step example:
    https://blogs.oracle.com/reynolds/entry/building_your_own_path
    Regards,
    Luis F. Heckler

  • Rhino calling overloaded Java methods with Array parameters

    Has anyone had any problems writing JavaScript code that calls overloaded Java methods?
    I have two Java defined methods that differ in the arguments, one takes a string the other takes an array of strings. The problem is calling Java methods within the JavaScript always calls the method with the String argument...
    /* Java Code Here */
    public void function(String s) { /* Function A */ }
    public void function(String[] sa) { /* Function B */ }
    /* JavaScript  Code Here */
    param = java.lang.reflect.Array.newInstance(java.lang.String, 2);
    param[0] = "test";
    param[1] = "test2";
    stringParam = "test3";
    /* Both function calls below end up calling the Function A from above */
    function(param);
    function(stringParam);PS...in case you're not familiar with Rhino,
    It is a mozilla package that embeds a JavaScript interpreter within a Java application...
    http://www.mozilla.org/rhino/

    haha...I can't even find my other thread :(
    Sorry about the double post...I'll go look for my other thread now

  • Notable to call java method from xslt

    Hi All,
    We are not able to call java methods that return org.w3c.dom.NodeList.
    All other methods invocation are working fine but process errors out when we try to call a method that returns org.w3c.dom.NodeList.
    Any help is highly appiciated.
    Vigni

    As pointed by others, you must expose your method as a custom function, registering with JDeveloper (for development time) as well as with SOA Suite (for runtime).
    In the link below you will find a simple step by step example:
    https://blogs.oracle.com/reynolds/entry/building_your_own_path
    Regards,
    Luis F. Heckler

  • Cant resolve class on XSLT Extension

    I have XSLT and I am trying to call a java method and I get
    java.lang.NullPointerException
    at oracle.xml.parser.v2.XSLExtFunctions.getClass(XSLExtFunctions.java:351)
    Trying even a simple example using java.lang.xxxx gets the same error.
    <!-- x.xsl: show value in Hexadecimal -->
    <xsl:stylesheet version="1.0" exclude-result-prefixes="Int"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:Int="http://www.oracle.com/XSL/Transform/java/java.lang.Integer">
    <xsl:template match="/">
    <xsl:variable name="x" select="99"/>
    <!-- Invoke public static toHexString() method on current node "." -->
    <x-hex><xsl:value-of select="Int:toHexString($x)"/></x-hex>
    </xsl:template>
    </xsl:stylesheet>
    This is XDK 9.2.0.6
    Thanks in advance.

    Terris Linenbach (guest) wrote:
    : Does the v2 parser support XSLT extension functions?
    : Here is a cool example of an implementation at
    : http://www.jclark.com/xml/xt.html :
    : A call to a function ns:foo where ns is bound to a namespace
    of
    : the form http://www.jclark.com/xt/java/className is treated as
    a
    : call of the static method foo of the class with fully-
    qualified
    : name className. Hyphens in method names are removed with the
    : character following the hyphen being upper-cased. Overloading
    : based on number of parameters is supported; overloading based
    on
    : parameter types is not. A non-static method is treated like a
    : static method with the this object as an additional first
    : argument. A constructor is treated like a static method named
    : new. Extension functions can return objects of arbitrary types
    : which can then be passed as arguments to other extension
    : functions or stored in variables.
    : For example, the following
    : <xsl:stylesheet
    : xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
    : xmlns:date="http://www.jclark.com/xt/java/java.util.Date"
    : xmlns="http://www.w3.org/TR/REC-html40"
    : result-ns="">
    : <xsl:template match="/">
    : <html>
    : <xsl:if test="function-available('date:to-string') and
    : function-available('date:new')">
    <xsl:value-of select="date:to-string(date:new
    ())"/></p>
    : </xsl:if>
    : </html>
    : </xsl:template>
    : </xsl:stylesheet>
    : will print out the current date.
    Our current release 2.0.2 does not support extension functions
    but they will be supported in the very near future.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • External methods in xslt mapping

    can we call external JAVA and ABAP methods in XSLT mapping ? 
    thanks
    kumar

    Kumar,
    Yes you can, please refer the below webelogs.
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Best regards,
    raj.

  • ABAP XSLT Extensions or XSLT (XI imported archive)?

    Hi all,
    I would like to know which is having better performance in a scenario with a significant number of messages.
    I know that ABAP XSLT Extensions is based in XSLT 1.0 and have some features of XSLT 2.0. So, for me it means some limitations and a disadvantage compared with all of XSLT 2.0 “standard” can offer.
    But, my question is related with performance and I just want to know which is faster.
    Thanks in advance,
    Cheers,
    Ricardo.

    Hi Ricardo,
    abap xslt has one great advantage
    abap stack does not have to communicate with
    java stack to perform the - so no RFC calls for mapping
    with many messages that might influence their flows
    but it wuold be best if you could just test it
    in YOUR environment (there are many test tools -
    like Loadrunner from Mercury) or you can write your own scripts
    and just test in your particular examle which one is better
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to call Java Map in XSLT map

    Hello,
    Can anyone tell me how to call Java Map in XSLT map.
    Thanks and Regards
    Hemant

    Hello, Vijay,
    Can you help in understanding how can we pass whole payload in the parameter in XSLT map.....
    for eg
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:javamap="java:DATEandTIME.Date_Time">
         <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
         <xsl:param name="inputparam" />
         <xsl:template match="/">
         <MT_TARGET>
              <date>
                   <xsl:if test="function-available('javamap:getDateValue')">
                       <xsl:value-of select="javamap:getDateValue($inputparam)"/>                    </xsl:if>
              </date>
              <time>
              <xsl:if test="function-available('javamap:getTimeValue')">
                       <xsl:value-of select="javamap:getTimeValue($inputparam)"/>                       <xsl:value-of select="$test"/>
              </xsl:if>
              </time>
              <project>
                        <xsl:value-of select= "//project"/>
              </project>
         </MT_TARGET>
         </xsl:template>
    </xsl:stylesheet>
    here we are passing static value in parameter.....
    Java code is:
                private static AbstractTrace trace = null;
                public static String getDateValue(Map inputparam)
                        trace = (AbstractTrace)inputparam.get(
                                 StreamTransformationConstants.MAPPING_TRACE );
                        Date now1 = new Date();
                        SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMd");
                        String dateString = formatter.format(now1);
                        return dateString;
                public static String getTimeValue(Map inputparam)
                            trace = (AbstractTrace)inputparam.get(
                                    StreamTransformationConstants.MAPPING_TRACE );
                            Date now1 = new Date();
                            SimpleDateFormat formatter = new SimpleDateFormat ("hhmmss");
                            String dateString1 = formatter.format(now1);
                            return dateString1;
    I want to pass whole payload so how can i pass it.

  • How to get Application Module in JDev 10.13 with own java Methode ?

    Hello,
    I've tried to save a table from my BC4J to file system...
    for this i call my class from a jsp page:
    <%
    try {
    // RESPONSE
    String aktDbName = request.getParameter("aktDbName");
    response.setContentType("text/html");
    ByteArrayOutputStream buffer = Err_alertLogPageController.saveAL(pageContext);
    String filename = "alert_"+aktDbName+".log";
    response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\"");
    // DOWNLOAD
    DataOutput output = new DataOutputStream(response.getOutputStream());
    byte[] bytes = buffer.toByteArray();
    response.setContentLength(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
    output.writeByte(bytes);
    } catch (Exception ex) {
    %>
    Sorry, error...
    <% } %>
    My Java Methode looks like this:
    public static ByteArrayOutputStream saveAL(PageContext ctx) {
    ByteArrayOutputStream baos = null;
    try {                         
    System.out.println("Get container...");
    DCBindingContainer bindings = (DCBindingContainer)ctx.getRequest().getAttribute("bindings");
    BindingContext bc = bindings.getBindingContext();
    System.out.println("get AM...");
    DCDataControl dc = bc.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    System.out.println("get View");
    ViewObject voAL = am.findViewObject("DispAlertLogView");
    System.out.println("create streamer...");
    baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    System.out.println("loop...");
    voAL.first();
    ps.println(voAL.getCurrentRow().getAttribute("Line").toString());
    while(voAL.hasNext()){
    voAL.next();
    ps.println(voAL.getCurrentRow().getAttribute("Line").toString());
    } catch (Exception e) {
    System.out.println("Error on FileSave (alert log): " + e);
    return baos;
    in principle it works well, but i get a null Pointer exception at:
    DCBindingContainer bindings = (DCBindingContainer)ctx.getRequest().getAttribute("bindings");
    I already tried to deliver PageLifecycleContext in jsp page, but then an error occur that it is not possible to deliver this variable.
    I hope you know a solution to get AppModul,
    or even deliver the PageLifecycleContext-Variable then i could get AppModul on my own
    Thanks
    Sebastian
    Message was edited by:
    Sebastian_ME

    Note that there is an extension called Simple Java Bean Editor that will give you back a similar tab - get it through help->check for updates

  • How to call java method from xsl

    hi friends,
    How to call a java method from xsl, i have a xsl file which will call the java method and retrieve the value and display it to the user. but its work well when i set xalan.jar and xerces.jar and the java class files in my classpath and run as
    java org.apache.xalan.xslt.Process -in navigate.xml -xsl nav-exst.xsl -HTML -out navoutpage.html[b]
    in the command prompt but when i deploy it as web application it gives error as
    [b]Namespace 'MyPack' does not contain any functions[b]

    OK. So, I think we can all conclude that you don't need to call any Java method, can't we? And, that wfUpdateMetadata is the command that will update your metadata.
    Now, the question is what are its arguments. It has two - the first is the name of a custom metadata field to be updated (let's suppose that one field is called xMinorVersion, and the other xMajorVersion), the other is the new value, e.g. <$wfUpdateMetaData("xMinorVersion", "New value.")$>As for new value - do you insist on using strings? Since you want to increase the value, it would be more convenient to work with numbers. For instance, with integers you could go with <$wfUpdateMetaData("xMinorVersion", xMinorVersion + 1)$>With strings you will need to convert it to numbers and back to strings. Besides, what happens if you have more than 100 minor versions? (you mentioned you want to add 0.01, but that would finally increase the major version, wouldn't it?) So, I think these two numbers are independent (perhaps, with exception that increase on the major version set the minor version to .00).
    If you want to present it, you can use profiles that will construct for you the representation 2.304 out of MajorVersion = 2, MinorVersion = 304
    Solved?

  • ESB XSLT Extension Functions

    Hi
    Could anybody tell me if we can use log4j in the java class which we write for XSLT Extension Functions which will be used in ESB XSL mappings?
    It is not recognizing log4j only.It is not giving any error also.
    Thanks
    Praveena

    Thanks Kanchan.
    This is talking about how to implement Extension functions.
    I have done this. but my question I am not able to use log4j for debugging purpose in this java class. It is not recognising this.
    We need to use logger instead of System.out.println .
    Thanks
    Praveena

  • Where to put property files used by XSLT extensions?

    Still fighting with Java XSLT extensions. I have narrowed the
    problem down: my XSLT extension cannot find its property file,
    which I use to store JDBC connect strings etc.
    What is the proper directory to put this file so the XSLT
    extension class can find it? I am using Oracle HTTP Server with
    XDK 9.0.

    Thanks for the answer, Steve!
    Depends on what call you're using in your extension function to
    read your properties.Maybe I tried a too simplistic approach. I'm just using this:
    Properties props = new Properties();
    try {
    props.load(new FileInputStream("/foo.properties"));
    etc.
    This (with the slash) works if the properties file is in the root
    directory of the filesystem, but it's a kludge.
    If you read your properties as a resource using
    getResourceAsStream(), then where the classloader expects to
    find your file depends on the resource name that you specify.So maybe I should use getResourceAsStream() then? What if I put
    the properties file inside the JAR with the extension classes?
    Or is there any way to reference the web root?
    --Jere

  • Calling Java methods from C program

    After a year or so using these excellent forums to answer my queries, without ever having to post a question, I've finally had to ask for help with this one. I've already looked through the JNI tutorial, and these forums, extensively, but I'm still not quite sure of how best to solve my problem.
    I need to call Java methods from a C program. I've already used JNI to call a simple C program from Java, and that's fine, but I just can't determine exactly what I need to do for the reverse to work.
    What is the definitive solution for calling Java from C? Is it to use the invocation APIs to create a JVM, and then access it through the various GetMethod, FindClass methods? Or can I 'reverse engineer' the process I followed to get Java to call C?? The tutorial is a bit confusing, as the example it gives uses Callback stuff, but I guess that's only useful when you want to go Java-C-Java??
    Advice appreciated,
    Rich

    Forgive my blatant bumping, but anyone, please?

  • Overloading main method

    hi all,
    If main method can be overloaded then why it is not working?
    class Passreference{
    void pass(){
                    Oops7.main(new String[]{"Apple","Windows"});
         Oops7.main(new int[]{10,20});
    public class Oops7 {
         public static void main(String[] args) {
    System.out.println("String"+"\t"+args);
    public static  void main(int x[] ){
         System.out.println("Integer"+"\t"+x);
    }The answer is :String     [Ljava.lang.String;@addbf1
    1.It is not printing the values that i am passing
    2.even if integer values are passed it is gives String     [Ljava.lang.String;@addbf1
    why not" Integer java.lan....."
    Thanks in advance,
    Cat

    Hello,
    the code you posted does not compile, and as suggested by previous posters, it is not clear what you are trying to achieve.
    Here is a code extract that compiles and demonstrates that class Oops7 has two method named main that are overloaded.
    import java.util.Arrays;
    * In support of OTN topic overloading main method
    public class TestOverloading{
        public static void main(String... args){
            Oops7.main(new String[]{"Apple","Windows"});
         Oops7.main(new int[]{10,20});
    class Oops7 {
        public static void main(String[] args) {
            System.out.println(Arrays.toString(args));
        public static  void main(int x[] ){
            System.out.println(Arrays.toString(x));
    }Edited by: jduprez on May 9, 2011 1:13 PM
    Beaten by Kay'... Well at least I revisited my extract to implement Peter's suggestion.

  • Any way (event) to call Java method after view created in JSF 2.0

    Hi,
    I am using JSF 2.0 Mojarra's implementation.
    I am interested to know if there is a way to call Java methods before and/or after view has been restored.
    I wanted to initialize data for my page in this Java method.
    I could see there is an event class PostRestoreStateEvent added in JSF 2.0. How to use it?
    I tired to use f:event element as below, but it does not work. Can anyone share anyother idea to achieve this behaviour?
    <f:metadata>
    <f:event type="postRestoreState" listener="#{employeeLoadBean.loadAfterRestoreView}"/>
    </f:metadata>
    Regards,
    Kishore K S

    Hi,
    The problem is solved as below.
    <f:metadata>
    <f:event type="javax.faces.event.PostRestoreStateEvent" listener="#{employeeViewEventListener.postRestoreState}"/>
    </f:metadata>
    The above calls the Java method #{employeeViewEventListener.postRestoreState} whenever View has been restored.
    It was not working when shortName of the event (ie., postRestoreState) is given and throwing ClassNotFound exception.
    Regards,
    Kishore K S

Maybe you are looking for

  • Cooling fan not work correctly

    my computer says the cooling fan not work correctly plase visit www.hp.com.go/teachcenter/startup

  • How do I get back into my ipad after its been disabled?

    How do I get back into my ipad after it has been disabled?

  • To improve performance of select

    Hi all, I premise that I'm not a Dba Administrator, but I must resolve a performance problem. I read the Rob Van Wijk thread "When your query takes too long ..." and I'll post you my tkprof result Trace file: c:\oracle\product\10.2.0\admin\orcl\udump

  • BBM acting up

    Hey, Just have an enquiry I use my BBM daily to one contact as were in a different country.. Worked fine all yesterday up until about 12pm today.. Since then messages i send are showing up the tick mark but not showing up the D.. I sent 3 messages ea

  • PHP and Postgresql nightmare

    Hello all.. I have read numerous articles and how-to's on compiling PHP that includes the PostgreSQL extensions and have followed all their recommendations. Yet, my apache insists on reading the PHP directive from /usr/libexec/apache2 and my installa