Extension elements with hyphens are not working
-----------------------------------------------
Key: XALANJ-2496
URL: https://issues.apache.org/jira/browse/XALANJ-2496
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: Xalan-extensions
Affects Versions: 2.7.1
Environment: JDK 1.5
XALAN 2.7.1
Reporter: Jason Pell
The following XSL and java class produce error:
SystemId Unknown; Line #8; Column #21; For extension element, could not find
method
com.pellcorp.xslt.MyDate.do-stuff(org.apache.xalan.extensions.XSLProcessorContext,
org.apache.xalan.templates.ElemExtensionCall).
<xsl:stylesheet version="1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="xalan://com.pellcorp.xslt.MyDate"
extension-element-prefixes="date">
<xsl:template match="/">
<out>
<date:do-stuff />
</out>
</xsl:template>
</xsl:stylesheet>
For class:
package com.pellcorp.xslt;
public class MyDate {
public MyDate() {
}
public static void
doStuff(org.apache.xalan.extensions.XSLProcessorContext context,
org.apache.xalan.templates.ElemExtensionCall extElem) {
System.out.println("doStuff!");
}
}
With a minor change to the class:
org.apache.xalan.extensions.MethodResolver
Method: public static Method getElementMethod(Class classObj,
String name)
To add the following to the beginning of the method:
if (name.indexOf("-")>0)
name = replaceDash(name);
As is currently done for getMethod(Class classObj,
String name,
Object[] argsIn,
Object[][] argsOut,
ExpressionContext exprContext,
int searchMethod)
Seems to fix the problem. However I have yet to fully investigate how well the
java extension works. Is this expected to work the way I am intending it?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]