User:Jeblad/xslt

From MediaWiki.org
Jump to navigation Jump to search

Given that Wikibase repo export RDF as XML, and the Wikibase client can reuse this, then it make sense to use Xpath to identify and extract information and to use XSLT to format the exported content. This will probably be much faster than creating an environment for Lua and processing the data inside that environment.

Parameters from the call would be passed to the XSLT template by XSLTProcessor::setParameter(), and the value can then be used inside the template. This will only work for flat data structures, it will not work for more complex structures. It will thus have the same problems as the existing templates when it comes to handling of non-flat structures.

It could be possible to bind Lua functions to XSLT functions by using XSLTProcessor::registerPHPFunctions(), thereby adding more complex processing to the mix.

The XSLT snippet could either be embedded as a part on an ordinary wikipage, or it could be a page by itself like a module. The later gives a more intuitive interpretation, as the parameters can be defined like the {{#invoke}} call for Lua modules.