Extension:XSL
![]() Release status: beta |
|
---|---|
Implementation | Parser function |
Description | Applies XSL transformations to XML documents |
Author(s) | Greg Rundlett (GregRundletttalk) |
Latest version | 2.0.0 (2019-10-31) |
MediaWiki | 1.32+ |
Database changes | No |
License | GNU General Public License 3.0 or later |
Download | |
Quarterly downloads | 1 (Ranked 162nd) |
Translate the XSL extension if it is available at translatewiki.net | |
The XSL extension performs an XSL transformation on XML documents. The purpose of the extension is to be able to re-use XML output from external systems. The parser function lets you take an XML document, apply an XSL transform and pull the resulting document into the wiki page. There are two optional parameters that allow you to enable wikitext parsing of the document; and to enable/disable caching of the result.
Installation edit
- Download and place the file(s) in a directory called
XSL
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'XSL' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage edit
{{#xsl: xsl |xml |parse=true |nocache=false }}
xsl
- The URL of the stylesheetxml
- The URL of the XML documentparse
- (optional) if enabled the output of the transformation will be parsed as wikitextnocache
- (optional) if enabled caching will be disabled for this page. Enable this to allow dynamic content
Using wiki pages edit
The URL of an XML or XSLT stylesheet may refer to a file on your server or even a page on your wiki. If you want to use the latter, you should refer to the "raw" source of the page, for instance
{{#xsl: {{fullurl:Test file.xslt|action=raw}}
|{{fullurl:Test file.xml|action=raw}}
|...
}}
Although it is probably not required, you may want to change the content type of your page to "plain text" (XML is not supported by default) or use a custom namespace and set its default content model to "plain text". See Manual:ContentHandler for further details.