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

<info-vDJW/ys76H/[email protected]> Sat, 1 May 2021 07:35:36 +0200
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Following Java code:
 
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)));
StreamResult out = new
StreamResult("file:///c:/outputdir/IRtest1-DOCX.docx");
transformer.transform(in, out);

works exactly as following command line:

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

Instead of returning single DOCX output it returns unzipped DOCX 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.  
Obviously additional step is needed to zip files from c:\outputdir\ into
single output.

Regards
Miro

-----Original Message-----
From: Michael Kay <[email protected]> 
Sent: Friday, April 30, 2021 1:56 AM
To: Mailing list for the SAXON XSLT and XQuery processor
<[email protected]>
Subject: Re: [saxon] How to process Altova XSLT-Word 2007+ with Saxon-EE
10.3 for Java

Thanks, Jirka. Perhaps it just works. Perhaps we even have some tests that
show that it works. But I wouldn't be 100% confident without trying it.

Michael Kay
Saxonica

> On 29 Apr 2021, at 22:31, Jirka Kosek <[email protected]> wrote:
> 
> On 27.4.2021 10:04, Michael Kay wrote:
>> As for your attempt to produce a .docx file directly from the command
line, this isn't something Saxon supports. It's something you can do from a
Java application (though I would need to do some thinking to work out
exactly how), but not from the command line.
> 
> I recall I was doing this more than 10 years ago. But it was necessary to
have empty or skeleton .docx file.
> 
> Then xsl:result-document could be used to create and populate individual
files inside the archive (.docx) file:
> 
> <xsl:result-document href="zip:.../document.docx!/word/document.xml">
> 
> --
> ------------------------------------------------------------------
>  Jirka Kosek      e-mail: [email protected]      http://xmlguru.cz
> ------------------------------------------------------------------
>     Professional XML and Web consulting and training services 
> DocBook/DITA customization, custom XSLT/XSL-FO document processing
> ------------------------------------------------------------------
>    Bringing you XML Prague conference    http://xmlprague.cz
> ------------------------------------------------------------------
> 
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/ 
> [email protected] 
> https://lists.sourceforge.net/lists/listinfo/saxon-help



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