F
Frank
Hey all,
I can't seem to get javascript running in my XSL document.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xalan="http://xml.apache.org/xalan"
xmlns:my-ext="ext1" extension-element-prefixes="my-ext">
<!--The component and its script are in the xalan namespace and
define the
implementation of the extension.-->
<xalan:component prefix="my-ext" functions="hi">
<xalan:script lang="javascript">
function hi() {
return 5;
}
</xalan:script>
</xalan:component>
<xsl:template match="/deadline">
<xsl:value-of select="my-ext:hi()"/>
</xsl:template>
</xsl:stylesheet>
I get this huge stack trace:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(ExtensionHandlerGeneral.java:293)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.xalan.extensions.ExtensionNamespaceSupport.launch(ExtensionNamespaceSupport.java:74)
at org.apache.xalan.extensions.ExtensionsTable.<init>(ExtensionsTable.java:118)
at org.apache.xalan.transformer.TransformerImpl.setExtensionsTable(TransformerImpl.java:437)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1169)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
at org.apache.xalan.xslt.Process.main(Process.java:1041)
Caused by: com.ibm.bsf.BSFException: JavaScript Error: Internal Error:
java.lang.IllegalArgumentException: Line number can not be negative:-1
at com.ibm.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEngine.java:182)
at com.ibm.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:87)
at com.ibm.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:106)
... 17 more
javax.xml.transform.TransformerException:
java.lang.reflect.InvocationTargetException
at org.apache.xalan.extensions.ExtensionNamespaceSupport.launch(ExtensionNamespaceSupport.java:80)
at org.apache.xalan.extensions.ExtensionsTable.<init>(ExtensionsTable.java:118)
at org.apache.xalan.transformer.TransformerImpl.setExtensionsTable(TransformerImpl.java:437)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1169)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
at org.apache.xalan.xslt.Process.main(Process.java:1041)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.xalan.extensions.ExtensionNamespaceSupport.launch(ExtensionNamespaceSupport.java:74)
... 7 more
Caused by: javax.xml.transform.TransformerException: Could not compile
extension
at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(ExtensionHandlerGeneral.java:300)
... 12 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(ExtensionHandlerGeneral.java:293)
... 12 more
Caused by: com.ibm.bsf.BSFException: JavaScript Error: Internal Error:
java.lang.IllegalArgumentException: Line number can not be negative:-1
at com.ibm.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEngine.java:182)
at com.ibm.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:87)
at com.ibm.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:106)
... 17 more
---------
Any help greatly appreciated.
Thanks,
Frank
I can't seem to get javascript running in my XSL document.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xalan="http://xml.apache.org/xalan"
xmlns:my-ext="ext1" extension-element-prefixes="my-ext">
<!--The component and its script are in the xalan namespace and
define the
implementation of the extension.-->
<xalan:component prefix="my-ext" functions="hi">
<xalan:script lang="javascript">
function hi() {
return 5;
}
</xalan:script>
</xalan:component>
<xsl:template match="/deadline">
<xsl:value-of select="my-ext:hi()"/>
</xsl:template>
</xsl:stylesheet>
I get this huge stack trace:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(ExtensionHandlerGeneral.java:293)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.xalan.extensions.ExtensionNamespaceSupport.launch(ExtensionNamespaceSupport.java:74)
at org.apache.xalan.extensions.ExtensionsTable.<init>(ExtensionsTable.java:118)
at org.apache.xalan.transformer.TransformerImpl.setExtensionsTable(TransformerImpl.java:437)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1169)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
at org.apache.xalan.xslt.Process.main(Process.java:1041)
Caused by: com.ibm.bsf.BSFException: JavaScript Error: Internal Error:
java.lang.IllegalArgumentException: Line number can not be negative:-1
at com.ibm.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEngine.java:182)
at com.ibm.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:87)
at com.ibm.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:106)
... 17 more
javax.xml.transform.TransformerException:
java.lang.reflect.InvocationTargetException
at org.apache.xalan.extensions.ExtensionNamespaceSupport.launch(ExtensionNamespaceSupport.java:80)
at org.apache.xalan.extensions.ExtensionsTable.<init>(ExtensionsTable.java:118)
at org.apache.xalan.transformer.TransformerImpl.setExtensionsTable(TransformerImpl.java:437)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1169)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
at org.apache.xalan.xslt.Process.main(Process.java:1041)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.xalan.extensions.ExtensionNamespaceSupport.launch(ExtensionNamespaceSupport.java:74)
... 7 more
Caused by: javax.xml.transform.TransformerException: Could not compile
extension
at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(ExtensionHandlerGeneral.java:300)
... 12 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(ExtensionHandlerGeneral.java:293)
... 12 more
Caused by: com.ibm.bsf.BSFException: JavaScript Error: Internal Error:
java.lang.IllegalArgumentException: Line number can not be negative:-1
at com.ibm.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEngine.java:182)
at com.ibm.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:87)
at com.ibm.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:106)
... 17 more
---------
Any help greatly appreciated.
Thanks,
Frank