【发布时间】:2014-01-25 18:06:34
【问题描述】:
我写了两个文件
第一个文件是NewFile.xml(我写了<?xml-stylesheet type="text/xsl" href="NewStylesheet.xsl"?>
在这个文件中),第二个文件是NewStylesheet.xsl(虽然我不认为xsl文件有错误,但我还是把它贴出来了):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
但是,当我运行“XSL Transformation”时出现错误:
15:55:02,242 INFO [main] Main - javax.xml.transform.TransformerFactory=null
15:55:02,243 INFO [main] Main - java.endorsed.dirs=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed
15:55:02,245 INFO [main] Main - launchFile: /Users/xuxu/Documents/workspace/.metadata/.plugins/org.eclipse.wst.xsl.jaxp.launching/launch/launch.xml
15:55:02,299 ERROR [main] JAXPSAXProcessorInvoker - Could not compile stylesheet
15:55:02,300 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:886)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:669)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformerHandler(TransformerFactoryImpl.java:961)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.addStylesheet(JAXPSAXProcessorInvoker.java:136)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:210)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: java.io.FileNotFoundException: /Applications/eclipse/Eclipse.app/Contents/MacOS/NewStylesheet.xsl (No such file or directory)
at java.io.FileInputStream.open(Native Method)
为什么说Caused by: java.io.FileNotFoundException: /Applications/eclipse/Eclipse.app/Contents/MacOS/NewStylesheet.xsl (No such file or directory)?这里有什么帮助吗?
【问题讨论】: