|Version 10 (modified by roadrunner, 10 years ago) (diff)|
The XsltMacro allows you to embed the result of an XSL-transformation in a page. It takes two parameters, a stylesheet and a document to transform. These can be an attachment on any wiki-page or ticket, any page from the htdocs area, any file in the repository, or any url (these options are similar to those for Trac's native ImageMacro). For more details see the documentation in the macro.
The macro can either be installed as a simple macro or as a plugin; the use_iframe option (see below) only works when installed as a plugin.
Because a macro's output is embedded in the html of the wiki page, the xsl-stylesheet must not produce a full html page. As an alternative, you can pass the use_iframe option to the macro; this will cause the macro put an <iframe> tag into the page instead of the results from the stylesheet. The stylesheet can (and must) then generate a complete html page.
If you have any issues, create a new ticket.
To install as a simple macro, just download this file and put it in your wiki-macros directory.
To install as a plugin, download the [download:xsltmacro zipped source],
unzip, change the directory to xsltmacro/0.9, run
python setup.py bdist_egg, and copy the resulting dist/xslt-0.3-pyX.Y.egg to your plugins directory.
The following table is produced with this macro call:
|John Smith||42 Easy Stfirstname.lastname@example.org|
|Mary Francis||1 Heavenly Wayemail@example.com|
Here's how you would tell it to use an iframe:
[[Xslt(format.xsl, info.xml, use_iframe, if_height=500)]]
- 15871 by rjollos on 2016-09-06 19:28:57
Rename 0.9 directory to 0.10
- 7914 by roadrunner on 2010-05-02 16:32:16
Pass (http) request parameters which start with xp_ to the stylesheet as
additional parameters. This can be useful for example to implement paging.
This closes #5275.
- 7913 by roadrunner on 2010-05-02 16:32:04
Simplified parameter extraction a bit.
Contributors: wuxxin at gmail.com
Feel free to leave any comments about the plugin here.
Comment by anonymous on Ma 06 iun 2006 06:46:14 EST
A hacked version of Xslt.py able to use external url's as doc or style.
With this version it is possible to do some cheap rss feed integration. Just point the xml to a http:// url and supply a local stylesheet.
Example RSS Feed conversion (please use your own stylesheet):
Based on xsltmacro-r790.zip
Thank you for your cool plugin,
wuxxin at gmail.com
Comment by roadrunner on Du 18 iun 2006 22:37:02 EST
Excellent idea! Thank you. Committed (with some fixes and cleanups) as rev .