使用eclipse运行XSLT时出错(Error when running XSLT with eclipse)

203 IT屋

When I use eclipse xsl development tools to run xsl transformation, it reports the following error. But using saxon there is no problem. SIt would be appreciated if some expert can provide possible solution.

12:44:14,714 INFO  [main] Main  - javax.xml.transform.TransformerFactory=null
12:44:14,725 INFO  [main] Main  - java.endorsed.dirs=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/endorsed
12:44:14,744 INFO  [main] Main  - launchFile: /gpfs/work01/work/scratch/users/feifan_liu/.metadata/.plugins/org.eclipse.wst.xsl.jaxp.launching/launch/launch.xml
12:44:14,945 ERROR [main] JAXPSAXProcessorInvoker  - Error checking type of the expression 'funcall(tokenize, [variable-ref(rColNames/result-tree), literal-expr(\|)])'.
12:44:14,953 ERROR [main] JAXPSAXProcessorInvoker  - Could not compile stylesheet
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:843)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:632)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformerHandler(TransformerFactoryImpl.java:918)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.addStylesheet(JAXPSAXProcessorInvoker.java:136)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.addStylesheet(JAXPSAXProcessorInvoker.java:127)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.PipelineDefinition.addStyleSheet(PipelineDefinition.java:161)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.PipelineDefinition.configure(PipelineDefinition.java:152)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:72)
12:44:14,954 FATAL [main] Main  - Error with stylesheet: file:/gpfs/work01/work/scratch/users/feifan_liu/com.nuance.xslt.ahfs/files/acp2detagged.xsl
org.eclipse.wst.xsl.jaxp.debug.invoker.internal.ConfigurationException: Error with stylesheet: file:/gpfs/work01/work/scratch/users/feifan_liu/com.nuance.xslt.ahfs/files/acp2detagged.xsl
    at org.eclipse.wst.xsl.jaxp.debug.invoker.PipelineDefinition.addStyleSheet(PipelineDefinition.java:163)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.PipelineDefinition.configure(PipelineDefinition.java:152)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:72)
解决方案

Eclipse seems to use Xalan Java which is an XSLT 1.0 processor and it simply complains about code in your stylesheet using the tokenize function which is new in XSLT/XPath 2.0 and that way not supported by Xalan. If you want to use XSLT 2.0 with Java then try Saxon 9. I don't know details however as to set up Eclipse to use Saxon.

当我使用eclipse xsl开发工具来运行xsl转换时,它会报告以下错误。但是使用萨克森没有问题。如果一些专家可以提供可能的解决方案,SIt将不胜感激。



  12:44:14,714 INFO [main] Main  -  javax.xml主要 -  java.endorsed.dirs = / usr / lib / jvm / java-1.6.0-openjdk-1.6.0.0.x86_64 / jre / lib /认可
12:44:14,744 INFO [main] Main - launchFile:/gpfs/work01/work/scratch/users/feifan_liu/.metadata/.plugins/org.eclipse.wst.xsl.jaxp.launching /launch/launch.xml
12:44:14,945错误[main] JAXPSAXProcessorInvoker - 检查表达式"funcall(tokenize,[variable-ref(rColNames / result-tree),literal-expr(\ |)])"。
12:44:14,953 ERROR [main] JAXPSAXProcessorInvoker - 无法编译样式表
javax.xml.transform.TransformerConfigurationException:无法在com.sun.org.apache.xalan上编译样式表
。 internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:843)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:632)
在com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformerHandler(TransformerFactoryImpl.java:918)
在org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker .addStylesheet(JAXPSAXProcessorInvoker.java:136)
在org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.addStylesheet(JAXPSAXProcessorInvoker.java:127)
在org.eclipse.wst .xsl.jaxp.debug.invoker.PipelineDefinition.addStyleSheet(PipelineDefinition.java:161)
在org.eclipse.wst.xsl.jaxp.debug.invoker.Pipelin eDefinition.configure(PipelineDefinition.java:152)
在org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:72)
12:44:14,954 FATAL [main] Main - 样式表错误:file:/gpfs/work01/work/scratch/users/feifan_liu/com.nuance.xslt.ahfs/files/acp2detagged.xsl
org.eclipse.wst.xsl。 jaxp.debug.invoker.internal.ConfigurationException:样式表错误:file:/gpfs/work01/work/scratch/users/feifan_liu/com.nuance.xslt.ahfs/files/acp2detagged.xsl
在org.eclipse .wst.xsl.jaxp.debug.invoker.PipelineDefinition.addStyleSheet(PipelineDefinition.java:163)
在org.eclipse.wst.xsl.jaxp.debug.invoker.PipelineDefinition.configure(PipelineDefinition.java:152)
在org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:72)

解决方案

Eclipse似乎使用Xalan Java,它是一个XSLT 1.0处理器,它只是使用 tokenize在您的样式表中抱怨代码功能,这是XSLT / XPath 2.0中的新功能,也不是Xalan不支持的。如果要使用XSLT 2.0与Java,请尝试撒克逊人9 。我不知道如何设置Eclipse来使用Saxon。


本文地址:IT屋 » 使用eclipse运行XSLT时出错