“Content is not allowed in prolog” error yet nothing before XML declaration

Elaborating on what @MartinHonnen has already helpfully commented… The error, Content is not allowed in prolog. arises because the XML prolog, which is everything before the root element in an XML document, has textual content that is not allowed. The error does not necessarily have to have occurred before the XML declaration. Specifically, the prolog … Read more

Resolving relative paths when loading XSLT files

I just got it, a late answer(tested on FOP 1.0) —— All you need is to set an uri resolver for your factory, as following works for me: TransformerFactory transFact = TransformerFactory.newInstance(); StreamSource xsltSource = new StreamSource(xsl); // XXX for ‘xsl:import’ to load other xsls from class path transFact.setURIResolver(new ClasspathResourceURIResolver()); Templates cachedXSLT = transFact.newTemplates(xsltSource); Transformer … Read more