Subject: RE: [xsl] xalan and replace "regex" From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 27 Dec 2007 18:11:15 -0000 |
Firstly, if you use -jar then it's irrelevant what's on your classpath. With this option, Java ignores the classpath entirely. Secondly, the error message indicates that someone is trying to load a class from Saxon 6 in the course of executing an extension function. Rather than fixing the classpath so that this class can be loaded, you need to fix the stylesheet so that it isn't requested. As I said before, I suspect the problem is conditional logic in the stylesheet that detects it is running Saxon and then assumes Saxon 6. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Mansour [mailto:mansour77@xxxxxxxxx] > Sent: 27 December 2007 15:43 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] xalan and replace "regex" > > Abel, I do not agree with you about the classpath thing. I > have checked my classpath many times. I followed your advice > about using saxon9.jar directly on the command line. It > worked fine, then I changed to a different directory where I > have some test files and did this: > > [mansour@mars xslt-test]$ java net.sf.saxon.Transform > -s:test-file.xml -xsl:sheet.xsl -o:out.xml > > and it worked fine as well, so the classpath is ok, but then > why would it work with the jar on the command line : > > java -jar /opt/Programs/saxon9/saxon9.jar -s:index.xml > -xsl:/opt/docbook/fo/docbook.xsl -o:book.fo > Warning: at xsl:stylesheet on line 8 of > file:/opt/docbook/fo/docbook.xsl: > Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > Warning: on line 337 of file:/opt/docbook/common/stripns.xsl: > The attribute axis starting at a document node will never > select anything Making portrait pages on USletter paper (8.5inx11in) > > > This is very confusing, I don't know what is going on. Here's > my classpath: > > echo $CLASSPATH > /opt/jdk/lib/dt.jar:/opt/jdk/lib/jconsole.jar:/opt/jdk/lib/sa- > jdi.jar:/opt/jdk/lib/htmlconverter.jar:/opt/jdk/lib/tools.jar: > /opt/jdk/lib/:/opt/tomcat/common/lib/servlet-api.jar:.:/opt/J2 > EE/lib/j2ee.jar:.::/opt/jdk/lib/xml-apis.jar:/opt/jdk/lib/xerc esImpl.jar:/opt/jdk/lib/xalan.jar:/opt/jdk/lib/jconsole.jar:/opt/jdk/lib/too ls.jar:/opt/jdk/lib/serializer-> 2.7.0.jar:/opt/jdk/lib/xsltc.jar:/opt/jdk/lib/serializer.jar:/ > opt/jdk/lib/sa-jdi.jar:/opt/jdk/lib/xercesImpl-2.7.1.jar:/opt/ > jdk/lib/fop.jar:/opt/jdk/lib/xmlgraphics-commons-1.2.jar:/opt/ > jdk/lib/commons-logging-1.0.4.jar:/opt/jdk/lib/xslthl.jar:/opt > /jdk/lib/xml-apis-1.3.02.jar:/opt/jdk/lib/dt.jar:/opt/jdk/lib/ > avalon-framework-4.2.0.jar:/opt/jdk/lib/htmlconverter.jar:/opt > /jdk/lib/batik-all-1.6.jar:/opt/jdk/lib/xalan-2.7.0.jar:/opt/j > dk/lib/commons-io-1.3.1.jar:.::/opt/jdk/lib/xml-apis.jar:/opt/ jdk/lib/xercesImpl.jar:/opt/jdk/lib/xalan.jar:/opt/jdk/lib/jconsole.jar:/opt /jdk/lib/tools.jar:/opt/jdk/lib> /serializer-2.7.0.jar:/opt/jdk/lib/xsltc.jar:/opt/jdk/lib/seri > alizer.jar:/opt/jdk/lib/sa-jdi.jar:/opt/jdk/lib/xercesImpl-2.7 .1.jar:/opt/jdk/lib/fop.jar:/opt/jdk/lib/xmlgraphics-commons-1.2.jar:/opt/jd k/lib/commons-> logging-1.0.4.jar:/opt/jdk/lib/xslthl.jar:/opt/jdk/lib/xml-api s-1.3.02.jar:/opt/jdk/lib/dt.jar:/opt/jdk/lib/avalon-> framework-4.2.0.jar:/opt/jdk/lib/htmlconverter.jar:/opt/jdk/li > b/batik-all-1.6.jar:/opt/jdk/lib/xalan-2.7.0.jar:/opt/jdk/lib/ > commons-io-1.3.1.jar:/opt/java_lib/weka-src.jar:/opt/java_lib/ > saxon9/saxon9-xqj.jar:/opt/java_lib/saxon9/saxon9-dom4j.jar:/o > pt/java_lib/saxon9/saxon9-sql.jar:/opt/java_lib/saxon9/saxon9- > xpath.jar:/opt/java_lib/saxon9/saxon9-ant.jar:/opt/java_lib/sa > xon9/saxon9-xom.jar:/opt/java_lib/saxon9/saxon9-s9api.jar:/opt /java_lib/saxon9/saxon9.jar:/opt/java_lib/saxon9/saxon9-jdom.jar:/opt/java_l ib/saxon9/saxon9-dom.jar > > You can easily see at the end all the jars from saxon9 !! > > > > Abel Braaksma wrote: > > Mansour wrote: > >> Ok, look, I have a somewhat big docbook files. I have been using > >> xalan to process them. I have just tried with saxon9 and the > >> processing failed with this message: > >> > >> Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > >> Exception in thread "main" java.lang.NoClassDefFoundError: > >> com/icl/saxon/pattern/NodeTest > >> at java.lang.Class.getDeclaredMethods0(Native Method) > >> at > java.lang.Class.privateGetDeclaredMethods(Class.java:2427) > >> at java.lang.Class.privateGetPublicMethods(Class.java:2547) > >> at java.lang.Class.getMethods(Class.java:1410) > >> at > >> > net.sf.saxon.functions.JavaExtensionLibrary.bind(JavaExtension > Library.java:301) > >> > >> at > >> > net.sf.saxon.functions.FunctionLibraryList.bind(FunctionLibrar > yList.java:83) > >> > >> at > >> > net.sf.saxon.expr.ExpressionParser.parseFunctionCall(Expressio > nParser.java:1840) > >> > >> at > >> > net.sf.saxon.expr.ExpressionParser.parseBasicStep(ExpressionPa > rser.java:1324) > >> > >> How, do I need to re-write everything to use saxon so > I can hl > >> my code or just stick to what I have? > > > > No. You can use (most of) your XSLT 1.0 code with an XSLT 2.0 > > processor. This error seems to imply that your classpath is not > > correctly configured and has nothing to do with the XSLT > files itself. > > Try to run it from the commandline instead (java -jar > saxon9.jar) and > > see if you still have that error. > > > > The first line is a warning, not an error. You can ignore > it. Or you > > can change the version attribute to 2.0 in your main > xsl:stylesheet. > > If some of your code uses XSLT 1.0 specific features that > have changed > > towards XSLT 2.0, you can switch on XSLT 1.0 backward compatibility > > mode by setting version or xsl:version of that specific > instruction to > > "1.0". > > > > Cheers, > > -- Abel Braaksma
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xalan and replace "regex", Mansour | Thread | RE: [xsl] xalan and replace "regex", Michael Kay |
RE: [xsl] xalan and replace "regex", Michael Kay | Date | [xsl] Sort By Multiple Values?, Wei, Alice Ju-Hsuan |
Month |