XSLT 和 XSL-FO 有什么区别? [英] What's the difference between XSLT and XSL-FO?

查看:28
本文介绍了XSLT 和 XSL-FO 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XSLT 和 XSL-FO 有什么区别?

What's the difference between XSLT and XSL-FO ?

我读过的每个资源都将它们视为 1,或者至少非常紧密地联系在一起..

Every resource I've read deal with them as if they were 1, or at least very closely tied..

推荐答案

我想知道问题的基础,因为我认为它很容易回答,但是只要你到这里:http://www.w3.org/TR/xsl/ 很明显它实际上是一个很好的问题 - 因为几乎页面上的第一件事是这样的声明:

I was wondering about the basis of the question because I thought it was easy to answer, however as soon as you go here: http://www.w3.org/TR/xsl/ it becomes clear that its actually a good question - because pretty much the first thing on the page is this statement:

该规范定义了可扩展样式表语言 (XSL) 的特性和语法,XSL 是一种用于表达样式表的语言.它由两部分组成:

This specification defines the features and syntax for the Extensible Stylesheet Language (XSL), a language for expressing stylesheets. It consists of two parts:

  1. 一种用于转换 XML 的语言文档 (XSLT) 和
  2. 用于指定的 XML 词汇表格式化语义.

然而,回到现实世界中,XSLT(这也是大多数人会认为 XSL 的意思)是一种将 XML 文档转换为其他内容的方法 - 其他内容通常不是另一个结构良好的文档也格式化为 XML(尽管我使用 XSLT 将 XML 呈现为 csv 和纯(ish)文本).

However, back in the real world, XSLT (which is also what most people will assume you mean by XSL) is a means for transforming XML documents into something else - that something else more often than not being another well structured document probably also formatted as XML (though I've used XSLT to render XML to csv and plain(ish) text).

另一方面,XSL-FO 是关于格式化的——关于以相当严格的方式在一个页面或一系列页面上布置内容.它很有用,因为它允许您管理分布在多个页面上的内容,指定页面(或偶数页和奇数页)的格式(包括页眉、页脚、边框、列等)并让您的内容流入其中相对简单.因此,人们会以 XML 格式加载大量数据,然后使用 XSLT 将该数据转换为由 XSL-FO 组成的文档,该文档又使用适当的工具呈现为 PDF 格式,用于打印或其他分发方式.

XSL-FO on the other hand is about formatting - about laying out content on a page or a sequence of pages in a fairly strict fashion. Its useful because it allows you to manage content that is spread across multiple pages, its relatively straightforward to specify the format of a page (or even and odd pages) including headers, footers, borders, columns, etc and have your content flow into that. One would therefore take a load of data in, say, an XML format and then use XSLT to convert that data into a document consisting of XSL-FO that in turn is rendered using an appropriate tool in say PDF for print or other means of distribution.

我的用例是获取一堆表格数据,将该数据导出为 XML,将其渲染为 XSL-FO,然后再将其渲染为 PDF,然后再由打印机将所述 PDF 转换为 500 页的目录.在 XSL-FO 中指定需要页码、特定情况下的分页符、目录和索引(每个都基于特定元素)以及渲染过程(到 PDF)处理页码的填充一刀切.

The use case I have is to take a pile of tabular data, export that data as XML, render that into XSL-FO and from there to PDF which goes to a printer who turns said PDF into a 500 page directory. One specifies in the XSL-FO that one wants page numbers, page breaks in specific circumstances, that there is a table of contents and an index (each based on particular elements) and the rendering process (to PDF) handles filling in the page numbers across the board.

希望你现在不那么困惑了..

Hopefully you're a bit less confused now..

这篇关于XSLT 和 XSL-FO 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆