This plugin isn't bundled with any XWiki product by default.
Plugin contributed by Marco Casavechia M. (MarcoLinuZ).
This plugin can be downloaded.

XSL Plugin

This is a simple plugin that lets you transform any external XML content into a XWiki page.

For example it can be used to retrieve, restyle and show external RSS contents into "dynamic" panels.

To work properly the plugin needs an XSL template that transforms the original source into the desired HTML code.

In this plugin's distribution file you'll find an "example" directory containing a simple XSL stylesheet that transform an RSS 2.0 feed into an HTML fragment.

How to use it

  • First of all you need a new Wiki page, so create it.
  • Now you have to attach the "example/rss2xhtml.xsl" file (included into the package) to the page.
  • Go to edit the page and add the following snippet code (change the URIs with something that works ;O):
$xwiki.xslURITransformer.cachedTransformURI("http://rss.host/path/to/the/rssfeed.xml","http://your.wiki.host/xwiki/bin/download/path/to/the/attached/rss2xhtml.xsl", "900")
  • Save the page and enjoy the included and reformatted rss ;O)

How does it works

The plugin uses 2 http connections to fetch the source and the xsl (that i often attach to the same page) and performs the transformation.

It has 2 functions that performs the same work but in 2 different ways:

  • $xwiki.xslURITransformer.cachedTransformURI(SourceURI,XSLURI,Timeout)
  • $xwiki.xslURITransformer.transformURI(SourceURI,XSLURI)
Common parameters:

The "SourceURI" parameter is the full URI of the resource that you want include.

The "XSLURI" parameter is the full URI of the XSL stylesheet to use for the transformation (if you followed my instructions you will find it attached to the page)

The "normal" version performs all the tasks every time the page is viewed (with lot of http traffic to fetch the resources and cpu usage for the transformation).

Cached Version:

The "cached" version has an extra "timeout" parameter that specify the amount of seconds to consider the resource as valid. This function maintains an internal cache of the transformed resources and send them back to the client without perform the whole work every time. The resource is fetched again after it expires (with a great increment of speed and a better memory usage).

Final notes

  • This whole package is released under Apache License.
Version 16.1 last modified by VincentMassol on 08/04/2008 at 18:24

Comments 0

No comments for this document

Attachments 0

No attachments for this document

Creator: MarcoLinuZ on 2008/04/07 11:24
This wiki is licensed under a Creative Commons license
1.4.1.10194