Xml4pmwiki

Summary: xml4pmwiki allows you to transform xml data using a xsl stylesheet in a pmwiki page
Version:20070615
Prerequisites:pmwiki 2.2.0beta and PHP4 >= 4.0.3 (with xslt extensions) or PHP5
Status: testing
Maintainer: jeanfabrice?
Categories: Includes

Description

xml4pmwiki allows you to transform xml data using a xsl stylesheet in a pmwiki page.

Installation

Download and copy xml4pmwiki.phpΔ to your cookbook/ directory. Add the following in your Local Customizations file:
include_once("$FarmD/cookbook/includexml.php");

Markup

once installed, the following markup is available :
(:xml4pmwiki xml=... xsl=... options:)

xml= and xsl= can take the following forms of parameters :

  • the 'Attach' form : see Uploads for the appropriate syntax
  • the 'Anchor' form : see IncludeOtherPages for the appropriate syntax. For convenience, xml4pmwiki discards [@ and @] you may have inserted at the begin / end of your section for lisibility
  • the 'Links' form : any Internet links like http://, ftp:// https:// or ftps://

availables options are :

  • +debug : display the raw result of the xml transformation in a <pre>...</pre> section
  • -markup : disable PmWiki Markup formatting
  • xslisutf8 : use this option if your xsl data are already utf8 encoded. By default, xml4pmwiki considers that your xsl datas are not utf8 and then encodes them. This is a tweak for being able to store xsl stylesheet with accentued characters in a wiki page section (We cannot directly stores utf8 datas in a page, can we ?)
  • other options based on the form $option=value are passed to the xsl stylesheet as xsl:param

Notes

  • xml4pmwiki is designed to be used on wiki where write access is restricted to editors who know what they are doing. i.e xml4pmwiki doesn't forbid the editors to link xml or xsl data located on third party web site (external site).
  • xml4pmwiki does not support http_proxy for retrieving data from external ressource
  • xml4pmwiki does not support "http redirect" when linking xml/xls data over http

Warnings :

  • xml4pmwiki uses an unstable pmwiki function : RetrieveAuthSection(). Since the return of this function may change in a near future, double check before upgrading. I will keep an eye on this function and will adapt xml4pmwiki recipe in case of any incompatibility.

Release Notes

2007-06-01
First public release.
2007-06-07
Calling xslt_process() seems to reset php locales to a default value. This is a problem for internationalized wikis which may use its own locale. I added a workaround to keep the save the defined locale before calling xslt_process() and restore it after the call.
2007-06-15
I added an optional argument 'xslisut8' to the markup. If your xsl stylesheet data are utf8 encoded, you need to add this argument. The default behaviour is to consider that your xsl data doesn't respect xsl standard and needs to be utf8_encoded by the markup before being use for xslt.

See Also

IncludeXML : Dominique Faure original recipe. Check this one if you want more controls on security or more features.

Contributors

Comments and bugs

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.