XSLT extension function probelm
Hi, I have some problems when I tried to migrate from Xalan to Oracle XSLT engine.
I have to traverse a huge XML document, the usual XPath is rather slow so we developed a Java class that kept a reference to some of the important Nodes.
The XSL looks like
<xsl:variable name="password">
<xsl:value-of select="customJavaClass:customFunctionReturningNode()/password/@value"/>
</xsl:variable>
After the call to the static function stays a valid XPath. That worked fine with Xalan but with Oracle I get something like "unexpected EOF".
Any ideas?
null
The whole application is based on heavy usage of XSL. Tens of transformations are done just for one user. We are trying to optimize as much as possible the memory usage and the speed. Using top-level stylesheet variables is too much memoty consumption (we tried it).
I don't think the code returning the Node Object is of importance. It is not even called (I inserted debug statements). I guess the problem is while the Oracle XSL processor is analyzing the XSL.
I'll try these keys that you are suggesting. Is there any URL I can retrieve additional information and performance analysis for these keys?
Similar Messages
-
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
PraveenaThanks 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 -
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 -
XSLT Mapping - user defined Extension function
Hi to all,
can somebody helps me, please?
I need an own function, that can be used by the XSL Mapper. First I have only tried the sample given in Path <BPELPM>\integration\orabpel\samples\demos\XSLMapper\ExtensionFunctions
There is a java file with the defined functions and a xml file with the definition of this function for the mapper and last but not least a jar-file with the java class.
I have copied the jar to <JDEV_HOME>\jdev\lib\ext directory and in JDeveloper I have added SampleExtensionFunctions.xml to Tools->Preferences->XSL Map -> "User Defined Extension Functions Config File" field. After a restart of JDeveloper I find 2 new functions in the "User Defined Extension Functions" component palette page when a XSL Map is open. That's fine.
But if I test the mapping I get an error: "Failed to transform source XML.
java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xpath.objects.XNodeSet.replaceChar([ExpressionCotext,]#STRING, #STRING)."
What is wrong?
Thanks in advance of your answer
best regard,
unoOracle XML support Extension function.
For example:
If we would like to import FAQDBUri.class with user-defined java functions, like TranslateDBUri(), we can write XSL file like this:
<xsl:template match="/" xmlns:dburig="http://www.oracle.com/XSL/Transform/java/FAQDBuri">
<xsl:variable name="urladd" select="dburig:TranslateDBUri($url)"/> -
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
nullThe 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.
-
Xalan xslt extension flat file to xml...
anyone used the xsltflat 2.0 to do flat to xml transformation? it does it by using xalan extension...
the packate is com.fs.xalan.extensions.* and test.com.fs.xalan.extensions.*
anyway, it works fine when I do it from command prompt... however when I tried to do it by calling it over Tomcat, the parsing gives me following funny error:
file:///e:/test.xsl; Line 21; Column 92; javax.xml.transform.TransformerException: For extension function, could not find method java.io.FileInputStream.streamIterator([ExpressionContext,] #STRING).
here is the seciton of the xsl file:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:stream="com.fs.xalan.extensions.StreamTools"
xmlns:txt="com.fs.xalan.extensions.TextFormatting"
extension-element-prefixes="stream txt">
<lxslt:component prefix="stream" elements="" functions="fileReader tokenize">
<lxslt:script lang="javaclass" src="xalan://com.fs.xalan.extensions.StreamTools"/>
</lxslt:component>
<lxslt:component prefix="txt" elements="" functions="trim ltrim rtrim lpad rpad trunc replace strip stripPunc stripWS upcase downcase">
<lxslt:script lang="javaclass" src="xalan://com.fs.xalan.extensions.StreamTools"/>
</lxslt:component>
<xsl:param name="inputStream" />
<xsl:template match="/">
<Employees>
<xsl:variable name="infile" select="stream:streamIterator($inputStream,' ')" />
<xsl:apply-templates select="$infile/stream/line" />
</Employees>
</xsl:template>
i know for sure the xsl works... there is nothing with wrong with xsl... so i am scratching my head right now...
thanks...Tomcat also uses XML (for the setting files) and thus: ships with an XML processor. My best guess: your application requires some more recent parser, but the Tomcat provided stuff is found first, and used. Maybe the TransformerException was the result of the famous "Sealing violation" or "Nu such method".
To check if this is the problem: make sure that your new xalan.jar file and (optionally) xerces.jar are in pole position in the class path.
If you happen to use Borland JBuilder: there are two places where you set the order of the required libraries: in the main project settings and in the Project, Run, JSP/Servlet, Server Options, button setup. Here, add your own xalan.jar and xerces.jar as well, and put them on top of the list.
a. -
Please help for User defined extension functions
the tutorial given for extension functions doesn't work as well as our new functions
even though i follow all the given steps and see the functions in my user defined extension functions tab in xslt map.
all the target nodes that use the extension function disappear in the resulted target xml.
please help.have you compiled your java file and uploaded the jar file(containg the .class file and the Manifest.MF file) in the <OC4J_HOME>\j2ee\home\applib directory and then restarted the server??
-
User Defined Extension functions XML file
Hi,
Can we define exception In custom XSLT function XML file.
Like i have following Custom XSLT function XML-
<?xml version="1.0" encoding="UTF-8"?>
<extension-functions>
<functions xmlns:uppercase="http://www.oracle.com/XSL/Transform/java/oracle.Uppercase">
<function name="uppercase:GetName" as="string">
<param name="fname" as="string"/>
<param name="lname" as="string"/>
</function>
</functions>
</extension-functions>
So in case i need to throw an exception in my java function GetName so how can i define that in XML?
Please give some suggestion?
Thanks.Hi,
Thanks for your reply. When I created extensions.xml (as advised by you) and tried specifying it as User Defined Extension Functions Config file, I get the following error:
Invalid User Extension Functions Config File
Invalid value 'object' for attribute:'as' line 5 column 52
i.e. the following line:
<function name="extensions:getMSPDate" as="object">
Any pointers on what will be the correct value for attribute 'as' for element 'function'?
Also, what is the default namespace being used in the extensions.xml?
Is there a link for more documentation on the format for extensions.xml? -
Is it possible to write our own xsl Extension Functions in Java using the oracle 9i xsl translator? If yes, how would I write the namespace to point to my class? I was able to do it with xalan, but unable so far with the oracle xslt. TIA.
You can using XDK for Java
-
Implemented OWSM -- XML-22045: (Error) Extension function error
good day
When I activated my OWSMAgent within ESB, I launched a null pointer Exception when running a fault, since I have reviewed the documentation WSM_DeploymentGuide and commented that it is not possible to add an error handler general, reviewing the logs I found the following error:
XML-22045: (Error) Extension function error: Class not found '
Missing class: com.cablemas.extensionfunctioncablemas.ExtensionFunctionCablemas
Dependent class: oracle.xml.xpath.XSLExtFunctions
Loader: oracle.xml: 10.1.0_2
Code-Source: / F: / product/10.1.3.1/OracleAS_1/lib/xmlparserv2.jar
Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in F: \ product \ 10.1.3.1 \ OracleAS_1 \ j2ee \ home \ oc4j.jar
This load was initiated at oc4j: 10.1.3 using the loadClass () method.
The missing class is available from the following locations:
1. Code-Source: / F: / product/10.1.3.1/OracleAS_1/j2ee/oc4j_soa/applib/ExtensionFunctionCablemas.jar (from <code-source> in / F: / product/10.1.3.1/OracleAS_1/j2ee/oc4j_soa/config / server.xml)
This source code is available in loader global.libraries: 1.0. This shared-library can be made visible to the "oc4j" by modifying the boot loader descriptor.
Class ExtensionFunctionCablemas use it to take the code of the error, locate it within a table in the DB and return the corresponding message, the null pointer exception only if it throws error. OWSM reviewing the request is recorded correctly, and the answer recorded as a fault but I'm not returning the message corresponding to error code.Greetings,
Quoted:
When using Oracle XSLT extensions, make sure you set the namespace of the extension class to be:
http://www.oracle.com/XSL/Transform/java/This was excerpted from the pdf at:
http://www.oracle.com/technology/tech/xml/xdk/collateral/OracleAS10g_10.1.2_XDK_FAQ.pdfThe namespace tells the application how to interpret your XSLT attributes\elements.
-Michael -
I am trying to execute XSL transformation of XML document in Oracle 9i database
and I am using java extension function in XSL stylesheet.
The XSL stylesheet namespace for the extension function is defined as follows:
xmlns:distance="http://www.oracle.com/XSL/Transform/java/Helper
Apparently the Oracle XSLT processor can not resolve this reference.
However, the error message is somewhat misleading:
ORA-03113: end-of-file on communication channel
I tried to load the java helper function in the database but this does not help.
I would appreciate if you could give me some info how to resolve the reference to a java extension function in Oracle 9i database.
Thanks in advance.We are trying to run java extension functions in Oracle 8i (8.1.7), using the 9.2.0.2 XDK and running into a similar problem.
For testing, the following xsl was used :
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="math"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:math="http://www.oracle.com/XSL/Transform/java/java.lang.Math">
<xsl:template match="/">
<xsl:value-of select="math:ceil(12.34)"/>
</xsl:template>
</xsl:stylesheet>
A stack trace yields the following:
java.lang.NullPointerException
at oracle.xml.parser.v2.XSLExtFunctions.getClass(XSLExtFunctions.java:351)
at oracle.xml.parser.v2.XSLExtFunctions.getMethod(XSLExtFunctions.java:229)
at oracle.xml.parser.v2.XPathExtFunction.evaluateMethod(XPathExtFunction.java:178)
at oracle.xml.parser.v2.XPathExtFunction.getValue(XPathExtFunction.java:137)
at oracle.xml.parser.v2.XSLExprBase.getStringValue(XSLExprBase.java:369)
at oracle.xml.parser.v2.XSLValueOf.processAction(XSLValueOf.java:99)
at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:369)
at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:200)
at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:473)
at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:450)
at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:248)
at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:138)
at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:210)
Seems like the classloader cannot find the java class files or having some access-related problems.
Any help is appreciated.
Thanks,
Atul -
Hello All,
I was wondering if anyone knew whether the most recent version of the oracle xslt processor
oracle.xml.parser.v2.oraxsl
implements the nodeset extension function found in saxon and xalanJ2?
A general list of extension functions would also be helpful.
Oh, and while I'm wishing, a classic mspacman coffeetable wouldn't be bad either.
Thanks!!
AlexI dont think you have it based on the patches you have. Take 8720251 to get the trim function, among other updates.
Tim -
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 -
Using Extension functions in Stylesheets
I'm using a stylesheet for transformations that works perfectly well as long as
I do not use extension functions. When I add an extension function call, I get
a
java.lang.NoClassDefFoundError: org/apache/xalan/extensions/ExpressionContext
whereas it should be looking for weblogic/apache/xalan/extensions/ExpressionContext.
Here's the list of namespace definitions I have
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="convert java"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:convert="xalan://com.ic.util.ICUtilities"
extension-element-prefixes="convert" version="1.0">Please advise which version of the database you are using. Please note that this forum is for issues related to the XML DB features of 9iR2 Database. Questions related to the XDK implimentations of PL/SQL should be posted in Technologies -> XML -> General. Please advise if you would like to have this question moved to that forum so the correct experts can answer it.
-
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>
Maybe you are looking for
-
My Macbook pro retina battery is not working
Hello everybody, I kinda need help, maybe somebody here can give me an advice. I kinda destroyed my Macbook pro retina with coffé My father spilled the coffé on the table and the coffé went exactly inside the laptop. It didnt work but after complete
-
Tomcat+Cocoon : error of pipeline
Hello, I've installed Tomcat and Cocoon ; Tomcat works fine but when I want to reach Cocoon (http://localhost:8888/cocoon) I've got the following error : org.apache.cocoon.ResourceNotFoundException: No pipeline matched request: index.htmlIn the Cocoo
-
Updating links...not!
HI, I've gone to former posts on this forum but it doesn't quite answer my question. I've also gone to InDesign help with no luck. I could have sworn that while trying to tweak artwork (an external Photoshop file) through InDesign and updating, I did
-
Did 10.4.7 enable two finger right click?
I already had the hack installed but not after the upgrade to 10.4.7 I don't have to toggle it off/on after reboot so it seems like the os update addressed this issue. Can anyone confirm this, just curious?
-
I did the security update this morning and when I restarted my Mac mini I simply get the wheel of death. Now what? Help!! Annie