1

I had written an XSLT 2.0 version file and when it is applied to an XML file it gives me following error:

ERROR:  'Unsupported XSL element 'http://www.w3.org/1999/XSL/Transform:sequence''

This is the Java code:

   TransformerFactory tFactory = TransformerFactory.newInstance();
   Transformer transformer = tFactory.newTransformer(new StreamSource("Test.xslt"));
   transformer.transform(new StreamSource("Old.xml"),new StreamResult(new    
   FileOutputStream("New.xml")));

Can someone help me out with this?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

2 Answers2

3

The default XSLT processors in java do not yet support XSLT 2.0. Check out here

You either need to stick with XSLT 1.0, or find a XSLT processor that supports XSLT 2.0

Community
  • 1
  • 1
Jayamohan
  • 12,734
  • 2
  • 27
  • 41
1

Try adding this line to your code

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

Note: Also add corresponding JAR files for the Saxon parser than you will be good to go. You can refer this link for JAR file references. Hope this will help.

user1188611
  • 945
  • 2
  • 14
  • 38