transformation1Add my vote for this tag xml2Add my vote for this tag create new tag
, view all tags


Apply a stylesheet to XML using the Sablotron tool


The SablotronPlugin uses CPAN:XML::Sablotron to transform an XSL stylesheet and XML data file into HTML. Both the XSL stylesheet and XML document are Wiki Topics.

Syntax Rules

Place the directive %XSLTRANSFORM{xsl="SablotronXsl",xml=...}% at the top of the XML document where SablotronXsl is the name of the stylesheet and ... is the xml codes.


Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %NEWPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Apply a stylesheet to XML using the Sablotron tool

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

Design History

  • Thanks to TWiki:Main.MartinCleaver for the TWiki:Plugins.XmlXslPlugin. My browser apparently does not have the feature needed to do client-side transformations so I make use of XML::Sablotron to perform the transformation on the server.
  • I wanted to be able to see the transformation take place during the Preview Changes of an XML document. This way any extraneous characters or parsing problems will show up as an error.

Issues Outstanding

  • Double quotes are used in the xml code so cannot follow proper form for TWiki::Func::extractNameValuePair
  • In most cases of error in the XML the result is an "Internal Server Error" - viewing the web server error log tells you the line number to fix. I really should handle this in the plugin.

Plugin Info

Plugin Author: TWiki:Main.CharlieReitsma
Copyright: © 2002 TWiki:Main.CharlieReitsma
© 2007-2011 TWiki:Main.TWikiContributors
License: GPL (GNU General Public License)
Plugin Version: 2011-02-01
Change History:  
2011-02-01: TWikibug:Item6638: Fix for TWiki-4.0 and later; doc improvements; XHTML fixes; changing TWIKIWEB to SYSTEMWEB -- TWiki:Main.PeterThoeny
2002-03-13: Bug fixes
2002-03-12: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: CPAN:XML::Sablotron
Other Dependencies: Sablotron tool http://sourceforge.net/projects/sablotron/
Perl Version: 5.005
Benchmarks: GoodStyle nn%, FormattedSearch nn%, SablotronPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/SablotronPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/SablotronPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/SablotronPluginAppraisal

Related Topics: SablotronXml, SablotronXsl, TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 SablotronPlugin.md5 r3 r2 r1 manage 0.2 K 2011-02-01 - 19:10 PeterThoeny  
Compressed Zip archivetgz SablotronPlugin.tgz r3 r2 r1 manage 5.3 K 2011-02-01 - 19:10 PeterThoeny  
Compressed Zip archivezip SablotronPlugin.zip r5 r4 r3 r2 r1 manage 7.4 K 2011-02-01 - 19:10 PeterThoeny  
Unknown file formatEXT SablotronPlugin_installer r3 r2 r1 manage 3.4 K 2011-02-01 - 19:10 PeterThoeny  
Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r16 - 2013-10-16 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.