简体   繁体   English

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

[英]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. 我正在寻找一些关于如何实现XSLT表以将我的XML(Word模板)转换为XSL-FO(PDF)模板的基本指令。 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. 请注意,我不能手动将这些转换为PDF。 This project requires that they be automatically generated, and thus require the XSLT sheet to convert them. 该项目要求自动生成它们,因此需要XSLT表来转换它们。

Thank you in advance. 先感谢您。 I know this is a pretty generic question, but I really don't know what I'm doing with XSLT. 我知道这是一个非常通用的问题,但我真的不知道我在用XSLT做什么。

Take a look at WordML2FO stylesheets here . 这里查看WordML2FO样式表。 Excerpt from the page: 摘录自页面:

These stylesheets were prepared by RenderX's development team and Microsoft for general use. 这些样式表由RenderX的开发团队和Microsoft准备用于一般用途。 They are used to convert documents in Microsoft's WordprocessingML XML vocabulary into documents in the W3C's XSL FO (XSLFO) vocabulary. 它们用于将Microsoft的WordprocessingML XML词汇表中的文档转换为W3C的XSL FO(XSLFO)词汇表中的文档。 These generic stylesheets produce XSL FO (XSLFO) suitable for RenderX XEP Engine. 这些通用样式表生成适用于RenderX XEP Engine的XSL FO(XSLFO)。

Download link 下载链接

The overall process is as follows: 整个过程如下:

  1. Create a Word document; 创建Word文档;
  2. Save As... it in Microsoft XML format; 另存为...它以Microsoft XML格式;
  3. Apply stylesheets from link above and get an XSL-FO document; 从上面的链接应用样式表并获取XSL-FO文档;
  4. Render XSL-FO into the output formats (PDF, PostScript, AFP, and others) using RenderX XEP or another XSL-FO formatting engine. 使用RenderX XEP或其他XSL-FO格式引擎将XSL-FO渲染为输出格式(PDF,PostScript,AFP等)。

MSDN: Transforming Word Documents into the XSL-FO Format provides with greater details. MSDN:将Word文档转换为XSL-FO格式提供了更多详细信息。

  • Download the Microsoft fo xslt files from Microsoft. 从Microsoft下载Microsoft fo xslt文件。
  • Open word document. 打开word文档。
  • Perform a "save as". 执行“另存为”。
  • Click more options. 单击更多选项。
  • Select Word 2003 XML document (*.xml). 选择Word 2003 XML文档(* .xml)。 Click transform. 单击转换。 Enter the 输入
    path to the FO xslt in C:\\Office C:\\ Office中FO xslt的路径
    Samples\\OfficeWordWordMLtoXSL-FO\\Word2FO.xsl. 样品\\ 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. 当我将pdf转换为docx或doc然后尝试将其保存为fo时,这似乎很难。 Works fine for original docx or doc files. 适用于原始docx或doc文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM