problem to transform xml and xslt to html

Hi,
I have a problem when I try to generate html from xml and xslt pages in Java code. I have to use the instruction and it doesn’t work:

//ERROR in the under function “TransFact.newTransformer”
Transformer trans = transFact.newTransformer(xsltSource);

and appears the following error:


ERROR: ‘Sintax Error in ‘rp210Elements:ClipCreationDateAndTime >> .’.’
ERROR: ‘It could not compile the stylesheet’
Exception in thread “main” javax.xml.transform.TransformerConfigurationException: No se ha podido compilar la hoja de estilos
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
at test.exampleSimple1(test.java:51)
at test.main(test.java:70)

The java code is very simple and I don’t know what more to test.

I need a solution as soon as possible because it’s urgent to deliver the java application.

If someone sould help me I will be very grateful.

NOTE: Have a look to the attached file. Files DVD.xml, FX.xslt, Report.xslt, Storyboard.xslt and the java code.

Regards,
Diego
error.rar (21.1 KB)

Hi,
Your stylesheet uses the XSLT 2.0 >> (order comparison) operator but you are trying to compile it using an XSLT 1.0 stylesheet processor. This will not work.

Thanks a lot, I didn’t know why it was,
It’s true that you say.
You know what java library could I use to generate it with XSLT 2.0 stylesheet processor. If you could help me I will be very grateful.
Regards,
Diego

Your stylesheet uses the XSLT 2.0 >> (order comparison) operator but you are trying to compile it using an XSLT 1.0 stylesheet processor. This will not work.

Hi,
There are several XSLT 2.0 processors but you could start with Saxon-B 8.9 from http://saxon.sourceforge.net/. To make it work, install Saxon and put …\saxon\Saxon8.jar into classpath, and change your code to override the default xslt processor:

System.setProperty("javax.xml.transform.TransformerFactory","net.sf.saxon.TransformerFactoryImpl");

Finally you need to remove the attribute “version=…” from the <xsl:output method=“html”…> lines in your xslt 2.0 stylesheets, or replace them with <xsl:output method=“xhtml” version=“1.0”…
Then they should work fine.
Cheers
Bill