Hello all,
I hope that my previous post were rejected by the moderator because of
size of the attachment.
All I wanted to say was that i developed a new plugin.
It can include and transform external resources into xwiki pages.
I used it to embed my pages with some external RSS feeds.
The plugin is based upon xsl transformations.
I attach to this mail only the README included into the package.
Tell me if you are intrested.
Hope to be useful.
--
By MCM.
Hello,
This is a simple plugin that lets you include an external content into any xwiki page.
Actually I used it to show external RSS contents into "dynamic" panels.
To work properly the plugin needs an XSL template that produces the desired html code from
the source content.
The "example" directory of this package countains a simple XSL stylesheet that
transform an RSS 2.0 feed into an html fragment.
How to build it:
- A precompiled version (only for JDK 1.5) is available into the dist/lib
directory of the package.
- you can build the whole project by typing:
ant -f ant/build.xml dist
How to install:
- Copy all the jars from the "dist/lib" directory into the
"WEB-INF/lib" of
your XWiki installation.
- Edit your "WEB-INF/xwiki.cfg" and add the following line into the
"xwiki.plugins" section:
com.xpn.xwiki.plugin.xsltransformer.XslURITransformerPlugin
- At the end of the same file, append the following lines (WEB-INF/xwiki.cfg)
#XSLTransormer Plugin configuration parameters
xwiki.xsluritransformer.debug=disabled
xwiki.xsluritransformer.connectiontimeout=15000
xwiki.xsluritransformer.fallbackencoding=UTF-8
- Restart your XWiki
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 to the page.
- Go to edit the page and add the following snippet code (change the uri 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 plugnin 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 wil 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).
The "cached" version has an extra "timeout" parameter that specify the
amount of seconds to consider the resource as valid.
This function mantains 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 incement of speed and a
better memory usage).
NOTE: This whole package is released under Apache License.
PS: Sorry for my english..
By Marco Casavecchia M.
(marcolinuz(a)gmail.com)