[jira] Created: (XALANJ-2496) Extension elements with hyphens are not working

View: New views
2 Messages — Rating Filter:   Alert me  

[jira] Created: (XALANJ-2496) Extension elements with hyphens are not working

by Xalan - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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: xalan-dev-unsubscribe@...
For additional commands, e-mail: xalan-dev-help@...


[jira] Commented: (XALANJ-2496) Extension elements with hyphens are not working

by Xalan - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/XALANJ-2496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756082#action_12756082 ]

Neale Upstone commented on XALANJ-2496:
---------------------------------------

This works for extension functions but not for elements, which is strange and inconsistent.

A patch to solve both was suggested in 2001 (http://www.mail-archive.com/xalan-dev@.../msg01731.html), but it seems only functions were dealt with.

Why?

> 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: xalan-dev-unsubscribe@...
For additional commands, e-mail: xalan-dev-help@...