Zibbobz
Zibbobz

Reputation: 765

XSLT - XML (Word) to XSL-FO (PDF)

I'm looking for some basic instructions on how to implement an XSLT sheet to transform my XML (Word Template) into an XSL-FO (PDF) template. I'm having trouble finding an actual place to download such a sheet (or get an example for re-coding), and I'm not entirely sure how to implement one once I find it.

Note that I cannot just convert these into PDFs manually. This project requires that they be automatically generated, and thus require the XSLT sheet to convert them.

Thank you in advance. I know this is a pretty generic question, but I really don't know what I'm doing with XSLT.

Upvotes: 3

Views: 10533

Answers (2)

Jeff Binnig
Jeff Binnig

Reputation: 79

  • Download the Microsoft fo xslt files from Microsoft.
  • Open word document.
  • Perform a "save as".
  • Click more options.
  • Select Word 2003 XML document (*.xml). Click transform. Enter the
    path to the FO xslt in C:\Office
    Samples\OfficeWordWordMLtoXSL-FO\Word2FO.xsl.
  • Click Save.

This seems to struggle when I convert a pdf to docx or doc then try to save that as fo. Works fine for original docx or doc files.

Upvotes: 3

Be Brave Be Like Ukraine
Be Brave Be Like Ukraine

Reputation: 7735

Take a look at WordML2FO stylesheets here. Excerpt from the page:

These stylesheets were prepared by RenderX's development team and Microsoft for general use. They are used to convert documents in Microsoft's WordprocessingML XML vocabulary into documents in the W3C's XSL FO (XSLFO) vocabulary. These generic stylesheets produce XSL FO (XSLFO) suitable for RenderX XEP Engine.

Download link

The overall process is as follows:

  1. Create a Word document;
  2. Save As... it in Microsoft XML format;
  3. Apply stylesheets from link above and get an XSL-FO document;
  4. Render XSL-FO into the output formats (PDF, PostScript, AFP, and others) using RenderX XEP or another XSL-FO formatting engine.

MSDN: Transforming Word Documents into the XSL-FO Format provides with greater details.

Upvotes: 8

Related Questions