[Snapshot 1999-07-26. Get the canonical/updated version: http://www.sci.kun.nl/sigma/Persoonlijk/egonw/xslt/.]
Send comment and bugs to: Egon Willighagen last modified on 23rd July. XSA doc: xslt-parser.xsa. |
XSLTYou wrote some XML, and have a XSL Template. You want to use this on your website, but want to use Perl with your webserver. No Problem! XML::XSLT will convert the XML doc on basis of the template. It is written in Perl and works. However, at this moment it is not yet a module, but a script. Neither are all xsl command implemented. Nor is it fast. But in the meanwhile still it works: watch it in action. At this moment we need a lot of input. So try this script and give us your comment on it. Missing/needed xsl elements, bugs, anything... This document gives some explanation on this project. Other Stuff to read is the Working Draft on XSLT and the XSL(T)-by-example page (see links). Below, given is a list of XSLT-command's that are supported. Supported XSLT commandsAt this moment the xslt-parser commands are out of focus with the XSL-T draft. The stylesheet files it accepts are not even valid XML conform the XSL Working Draft. At this moment at least. Each element the script encounters that doesn't start with xsl: (or are in the xsl namespace) are regarded to be markup and handled as is. This leads to some strange sheets like the CML2CML stylesheet furtheron, in which the first to lines (<?xml version... and <?xml-stylesheet...) are not xml declarations but simple markup.
Action!Oke, let's see it work. The script takes a project name <project>. The files <project>.xml and <project>.xsl are read and converted to an internal object tree with XML::DOM. Then the XSL template is parsed against the XML tree, which results in a new doc that is redirected to STDOUT. That's all. Ofcourse, it need not be HTML. With XSLT you can convert any XML document with any XSL doc you like. This is the CML-project:
This is the Agenda-project:
Script optionsThe script can be used as an CGI script, but also as a command-line utility. Also accepts a XSL Template other than <project>.xsl. These behaviours are selected with some options. Run xslt-parser without options or parameters at the commandline to view its syntax. the -n option the -s option DownloadDownload version 0.1 of the script here. It requires the modules XML::Parser and XML::DOM which can be obtained from CPAN. A changelog is available. Bugs
What's Next?To do:
LinksXSL-T
Other |