How to process Altova XSLT-Word 2007+ with Saxon-EE 10.3 for Java

<info-vDJW/ys76H/[email protected]> Tue, 27 Apr 2021 09:44:39 +0200
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Hello Saxon gurus, I'm a Saxon novice. I have just basic knowledge of XSLT
1.0 and Java. I hope my question is not too basic.


I created my first project in Altova StyleVision. Results are two XSLT-s:
IRtest1-RTF.xslt (XSLT-RTF) and  IRtest1-DOCX.xslt (XSLT-Word 2007+). Both
works fine in StyleVision. 

I create Java Servlet with Saxon EE 10.3. Servlet works fine with XSLT 2.0
IRtest1-RTF.xslt but does not work with XSLT 3.0 IRtest1-DOCX.xslt. Main
part of straightforward Java code is:

 

TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl(); 

StreamSource xslStream = new StreamSource(new
ByteArrayInputStream(inputXSL.getBytes(encoding)));

Transformer transformer = factory.newTransformer(xslStream);

StreamSource in = new StreamSource(new
ByteArrayInputStream(dataXML.getBytes(encoding)));

ByteArrayOutputStream os = new ByteArrayOutputStream();

StreamResult out = new StreamResult(os);

transformer.transform(in, out);

 

Last sentence fails with:

Error in xsl:result-document/@href on line 283 column 87 

  SXRD0002  The system identifier of the principal output file is unknown 

 

Line 283 of IRtest1-DOCX.xslt XSLT is: 
<xsl:result-document href="{$altova:sPrefix}word/document.xml"
format="zip-format">

 

I guess I should use Xslt30Transformer and setBaseOutputURI method:
(https://www.saxonica.com/html/documentation10/javadoc/net/sf/saxon/s9api/Xs
lt30Transformer.html#setBaseOutputURI-java.lang.String- ), but I do not know
how to change my Java code? 

Is it possible to use Altova XSLT-Word 2007+ with SaxonEE?

 

Also following command line on Windows 10 does not work as expected (full
paths omitted for clarity) :

java -jar saxon-ee-10.3.jar -xsl:IRtest1-DOCX.xslt input.xml
-o:IRtest1-DOCX.docx

 

Instead of getting DOCX output I get folders _rels, docProps, word with
files and file [Content_Types].xml. If I manually zipped them into
IRtest1-DOCX.docx, Word can open docx successfully.  
Thanks for any help.

 

Regards

Miro

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help