package com.thaiopensource.validate.schematron;

import net.sf.saxon.lib.FeatureKeys;
import net.sf.saxon.TransformerFactoryImpl;

import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXTransformerFactory;

public class NewSaxonSchemaReaderFactory extends SchematronSchemaReaderFactory {
  public SAXTransformerFactory newTransformerFactory() {
    return new TransformerFactoryImpl();
  }

  public void initTransformerFactory(TransformerFactory factory) {
    factory.setAttribute(FeatureKeys.XSLT_VERSION, "2.0");
    factory.setAttribute(FeatureKeys.LINE_NUMBERING, Boolean.TRUE);
    factory.setAttribute(FeatureKeys.VERSION_WARNING, Boolean.FALSE);
  }
}

@@ -473,24 +473,36 @@
  factory) %7B%0A
+    try %7B%0A  
     factory.
@@ -548,16 +548,128 @@
 %222.0%22);%0A
+    %7D catch (IllegalArgumentException e) %7B%0A      // The old Saxon 9 (pre HE/PE/EE) throws this exception.%0A    %7D%0A
     fact

Fix issue 159 - catch exception thrown by Saxon B when we set the XSLT version feature.