This recipe takes advantage of XML and XSL functions provided by PHP and its associated modules to let you apply a XSL transformation on XML data and display the results into a wiki page.
A basic sample usage may be to syndicate your PmWiki site to other feeders (and display their datas).
Before all, XML and XSL support must enabled for your PHP installation. You may check this by temporary setting
$EnableDiag = 1 in your config-file and using
?action=phpinfo as described in AvailableActions.
According to the PHP version, the recipe needs the following extensions enabled:
- PHP 4.x: php_domxml, php_xslt
- PHP 5.x: php_xsl
You may refer to your ISP and the PHP documentation for more details on extensions availability and how to enable it.
Once installed, the following markups are available:
(:includexml xml=DATA_SOURCE xsl=STYLESHEET_SOURCE OPTIONS:)
- Renders an external xml DATA_SOURCE using the external xsl STYLESHEET_SOURCE.
(:xsl xml=DATA_SOURCE OPTIONS:)...STYLESHEET_DATA...(:xslend:)
- Renders an external xml DATA_SOURCE using the enclosed xsl definition.
(:xslend:)is not required when using
(:xml xsl=STYLESHEET_SOURCE OPTIONS:)...XML_DATA...(:xmlend:)
- Renders enclosed xml data using an external xsl STYLESHEET_SOURCE.
(:xmlend:)is not required when using
Parameters and options
- Respectively, the XML data source to process and the XSL stylesheet data source to use for the transformation.
- This could be either:
- The link target specification is handled by the Linked Resource Extras recipe. See there for syntaxic details and usage options.
- The parameter
src=DATA_SOURCEis equivalent to
- Disables PmWiki Markup formatting of processed datas (useful when generating xhtml).
- Disables most of output formatting (for development phases).
The expected XSL transformation should generate a plain text stream decorated with PmWiki markup. Nevertheless, with the
-markup option, you may use appropriate stylesheet to generate (x)html directly.
The markup parameters are filtered and all
-... unhandled options are silently discarded. All other parameters are forwarded to the XSL stylesheet, including
xsl=... as global parameters (according to the triggering markup, the
xsl=... values may only be available as
'-' for the relevant stylesheet).
The includexml-samples.zipΔ provides samples stylesheets to apply on rss feeds. As an usage example, the following directive (on a single line) would retrieve the 7 last PmWiki-users mailing-list messages:
(:includexml xml=http://rss.gmane.org/gmane.comp.web.wiki.pmwiki.user xsl=Attach:rdf2pm.xsl count=7:)
The following configuration variables may be helpful to suit the recipe to your needs:
- Maintains the different parameters such as include_path options and stream context data useful when fetching external datas (auth, proxy,...). You may refer to the PHP documentation for more details.
- Gives the name of the character decoding function processing the transformation result before returning it to PmWiki.
- Fixed trimming bug of
- Major rewrite.
- Cleaned code, merging unreleased enhancements. Updated licensing terms.
- Enabled wiki link convention.
- Tidy up code and parameters forwarding.
- First public release.