问题
Following the steps mentioned here: http://docbook.sourceforge.net/release/xsl/current/webhelp/docs/ch02s01.html
ant webhelp -Doutput-dir=test-ouput
(ouput is a typo in the documentation I think, but I tested it with test-ouput
and test-output
with the same result)
Tested with
- Windows 8 and Windows 8.1
- java version "1.7.0_51"
- ant 1.8.2 and ant 1.9.3
- docbook-xsl-1.78.1
- xerces-2_11_0
- saxon6-5-5
Any idea where I should look towards?
Output:
Buildfile: D:\apps\docbook-xsl-1.78.1\webhelp\build.xml
validate:
clean:
[delete] Deleting directory D:\apps\docbook-xsl-1.78.1\webhelp\test-ouput
chunk:
[mkdir] Created dir: D:\apps\docbook-xsl-1.78.1\webhelp\test-ouput
[xslt] Processing D:\apps\docbook-xsl-1.78.1\webhelp\docsrc\readme.xml to D:\apps\docbook-xsl-1.78.1\webhelp\test-ouput\null2007605189
[xslt] Loading stylesheet D:\apps\docbook-xsl-1.78.1\profiling\profile.xsl
[xslt] Processing D:\apps\docbook-xsl-1.78.1\webhelp\test-ouput\null2007605189 to D:\apps\docbook-xsl-1.78.1\webhelp\test-ouput\null295245132
[xslt] Loading stylesheet D:\apps\docbook-xsl-1.78.1\webhelp\xsl\webhelp.xsl
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/autoidx.xsl: line 551: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/autoidx.xsl: line 600: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/autoidx.xsl: line 600: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/autoidx.xsl: line 624: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/autoidx.xsl: line 624: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/lists.xsl: line 815: Attribut 'type' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/callout.xsl: line 109: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/xref.xsl: line 181: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/xref.xsl: line 966: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 96: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 96: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 131: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 131: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 171: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 171: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 707: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 924: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 1041: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 1171: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 1171: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 1271: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/inline.xsl: line 1309: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/glossary.xsl: line 329: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/glossary.xsl: line 329: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/glossary.xsl: line 402: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/glossary.xsl: line 402: Attribut 'href' befindet sich nicht in einem Element.
[xslt] : Warning! file:/D:/apps/docbook-xsl-1.78.1/xhtml/annotations.xsl: line 106: Attribut 'onClick' befindet sich nicht in einem Element.
[xslt] : Error! null
[xslt] Failed to process D:\apps\docbook-xsl-1.78.1\webhelp\test-ouput\null2007605189
BUILD FAILED
D:\apps\docbook-xsl-1.78.1\webhelp\build.xml:62: javax.xml.transform.TransformerException: java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:716)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:194)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:852)
at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:388)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
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:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.referenceToNodeSet(BasisLibrary.java:998)
at webhelp.l10n$dot$language()
at webhelp.topLevel()
at webhelp.transform()
at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:603)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:709)
... 21 more
---------
java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.referenceToNodeSet(BasisLibrary.java:998)
at webhelp.l10n$dot$language()
at webhelp.topLevel()
at webhelp.transform()
at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:603)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:709)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:194)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:852)
at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:388)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
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:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 13 seconds
回答1:
Based on the stack trace, it seems you are using Xalan for xsl transformation. It is recommended to use Saxon 6.5.5 with Webhelp which too is a Java impl. You can point to Saxon by setting xslt-processor-classpath in build.properties to the location of your saxon jar. In the meanwhile, you should also set xercesImpl.jar and xml-apis.jar properties.
Modify the following in the webhelp build.properties so that they point to your local copy of the jars indicated:
- Saxon 6.5 jar
- Xerces 2: xercesImpl.jar
xml-commons: xml-apis.jar
xslt-processor-classpath=/usr/share/java/saxon-6.5.5.jar
xercesImpl.jar=/usr/share/java/xercesImpl.jar
xml-apis.jar=/usr/share/java/xml-apis.jar
回答2:
Very important
build.properties
xslt-processor-classpath=d:\\apps\\saxon\\saxon.jar
xercesImpl.jar=d:\\apps\\xerces\\xercesImpl.jar;d:\\apps\\saxon\\saxon.jar
xml-apis.jar=d:\\apps\\xerces\\xml-apis.jar
The line starting xercesImpl...
needs an additional reference to saxon.jar to work also with larger xml input files.
来源:https://stackoverflow.com/questions/22482981/docbook-xml-and-webhelp