Extension:XsltTransformer

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
XsltTransformer
Release status: beta
Implementation Special page, Parser extension
Description Output pages to various formats, define types throught SMW, including support for FOP and custom output.
Author(s) Iwi2talk
Latest version 0.1 (2009-03-31)
MediaWiki 1.11.0+
License GPL
Download XsltTransformer-0.1.zip
Parameters
wgXsltFopBin
Hooks used
AjaxAddScript
SkinTemplateToolboxEnd
ArticleViewHeader
Translate the XsltTransformer extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?[edit]

With this extension you can save individual pages in a format of your choice. Furthermore, support for Semantic Mediawiki(SMW) makes it possible to categorize certain types of output and output options will be assigned accordingly. You can either create your own XSL stylesheets for custom modifications or rely on the powerful export functions of Apache FOP, which includes PDF.

You can edit your stylesheets directly in Mediawiki which makes it very easy to change your layout whenever you need to. You can even define other transformations to be applied sequentially, making modularized exporting simple and efficient.

Usage[edit]

You can either use predefined output types, or create your own. Typically, you would create a category and define a certain export type by pointing to a XSL stylesheet:

[[Has xslt stylesheet::Xslt:ShoppingList.xsl| ]]

Once you add pages to this category you will see a "Save as.." link in the toolbox. The linked page contains all output formats, including descriptions, that were specified for any and all categories that this page belongs to. Select the desired format and download the file.

The XSL stylesheets contain all the necessary information needed to produce the final file, even if values have to be passed to other parsers, such as FOP. This is primarily achieved through XSL comments. Here is a common example for PDF with FOP:

<xsl:comment>
[[Has content-type::application/pdf]]
[[Has content-disposition::generated.pdf]]
[[Has post-processor::FoDocBook]]
[[Has post-processor::Fop]]
[[Has title::Shopping list (PDF)]]
[[Has description:: A5 sized PDF, suitable as a shopping list.]]
</xsl:comment>

Requirements[edit]

This extension heavily depends on Semantic Mediawiki (SMW), please install it first.

Installation[edit]

To install this extension, extract the archive in your extensions folder and add the following to LocalSettings.php :

include_once('extensions/XsltTransformer/XsltTransformer.php');

For detailed instructions, please see the INSTALL file.

Configuration parameters[edit]

To be able to use the optional FOP support you have to give pass the correct path of the FOP executable to the extension in LocalSettings.php :

$wgXsltFopBin = "/your/path/to/fop.sh";

Contact and Feedback[edit]

You can find our contact information in the README file. Please either send us suggestions, bug reports and general feedback directly or leave it on the discussion page.


See also[edit]