I have some difficulties in getting the DocumentWrapper to work with JDOM. I hope you may be able to help me find the error.
I'm using Java Servlet to do XSLT transform using Saxon 8.7. I used JDOM to validate my XML and resolve DTD and all entities references.
I use the Saxon DocumentWrapper so I can make use of the line numbering feature. If I use this code:
transformer.transform(jin, new StreamResult(outputSystemID)); (method #2) it transformed okay but the linenumbering is not working. They show "-1" as the line number.
When I tried method #1, the transform stopped but reported no error messages. I couldn't catch any exception. Am I missing something that I didn't realized? Below is the code snippet:
Thanks for your help.
P. Corbetti
//Code snippet
  SAXBuilder builder = new SAXBuilder();
  sourceDoc = (Document) builder.build(sourceSystemID);
  // Give it a Saxon wrapper
  DocumentWrapper docw = new DocumentWrapper(sourceDoc, sourceSystemID, new Configuration());
  net.sf.saxon.Configuration config = new net.sf.saxon.Configuration();
  // set the source documents to maintain line numbers,
  // for the benefit of the saxon:line-number() extension function as well as run-time tracing.
  jin = new JDOMSource(sourceDoc);
  jout = new JDOMResult();
  Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltSystemID));
  transformer.setParameter(paramname, paramvalue);
  try {
      transformer.transform(docw, new StreamResult(outputSystemID)); // method #1
      /* transformer.transform(jin, new StreamResult(outputSystemID)); */ // method #2
  } catch (net.sf.saxon.instruct.TerminationException terr) {
    System.out.println("Error: transform<" + terr);
  } catch (net.sf.saxon.trans.DynamicError dyerr) {
    System.out.println("Error: transform<" + dyerr);
  } catch (TransformerConfigurationException tcerr) {
    System.out.println("Error: transform<" + tcerr);
  } catch (TransformerFactoryConfigurationError tfcerr) {
    System.out.println("Error: transform<" + tfcerr);
  } catch (TransformerException err) {
    System.out.println("Error: transform<" + err);