# File: README
[ "README", "AUTHORS", "ChangeLog", "xslt.c", nil].each do
XML.view_html
XML::XSLT.view_html
XML::XSLT::TransformationError.view_html
XML::XSLT::ParsingError.view_html
XML::XSLT::XSLTError.view_html
end
README / Wed Mar 01 12:20:59 CET 2006

Ruby/XSLT

About

Ruby/XSLT is a simple XSLT class based on libxml <xmlsoft.org/> and libxslt <xmlsoft.org/XSLT/>

Licence

Copyright (C) 2003, 2004, 2005 Gregoire Lejeune <gregoire dot lejeune at free dot fr>

Ruby/XSLT is freely distributable according to the terms of the GNU General Public License (see the file ‘COPYING’).

This program is distributed without any warranty. See the file ‘COPYING’ for details.

DOWNLOAD

Last version

Old versions

CVS access

The CVS repository is available at rubyforge.org. You can browse it or access it via anonymous access :

  cvs -d :pserver:anonymous@rubyforge.org:/var/cvs/ruby-asp login
  cvs -d :pserver:anonymous@rubyforge.org:/var/cvs/ruby-asp checkout ruby-xslt

See this page for more informations

INSTALLATION

You need to unzip rdoc-template in the parent directory if you want to generate the documentation

        ruby extconf.rb # see CONFIGURATION for more options
        make
        make test
        make doc
        sudo make install

CONFIGURATION

  --help                   display this help and exit

  --with-xslt-lib=PATH
  --with-xslt-include=PATH
  --with-xslt-dir=PATH     specify the directory name for the libxslt include
                           files and/or library

  --enable-error-handler   enables a VERY crude error handler. Error messages
                           are appended to the class variable XML::XSLT and can
                           be accessed with the class method XML::XSLT.errors
                           (will change in a future version)
  --disable-exslt          disables libexslt support <http://exslt.org/>

  --enable-debug           compile with memwatch
                           <http://www.linkdata.se/sourcecode.html>

EXAMPLES

Simple example

        require 'xml/xslt'

        xslt = XML::XSLT.new()
        xslt.xml = "text.xml"
        xslt.xsl = "test.xsl"

        out = xslt.serve()
        print out;

REXML support

        require 'rexml/document'
        require 'xml/xslt'

        xslt = XML::XSLT.new()

        xslt.xml = REXML::Document.new File.open( "test.xml" )
        xslt.xsl = REXML::Document.new File.open( "test.xsl" )

        out = xslt.serve()
        print out;

XML::Smart support

        require 'xml/smart'
        require 'xml/xslt'

        xslt = XML::XSLT.new()

        xslt.xml = XML::Smart.open( "test.xml" )
        xslt.xsl = XML::Smart.open( "test.xsl" )

        out = xslt.serve()
        print out;

Parameters support

        require "xml/xslt"

        xslt = XML::XSLT.new()
        xslt.xsl = "parameter.xsl"
        xslt.xml = "test.xml"
        xslt.parameters = { "p1" => "the first parameter ...",
                            "p2" => "'and the second one!'" }
        xslt.save("test1.html")

        xslt.parameters = { "p1" => "Ruby...",
                            "p2" => "'...is cool !'" }
        xslt.save("test2.html")

External functions support

        require "xml/xslt"

        class XML::XSLT
          def round_trip( arg )
            arg
          end
          def type( arg )
            arg.class.to_s
          end
        end

        xslt = XML::XSLT.new()
        xslt.xsl = "functions.xsl"
        xslt.xml = "test.xml"
        XML::XSLT.extFunction("round-trip", "http://test.none", xslt)
        XML::XSLT.extFunction("type", "http://test.none", xslt)

        print xslt.serve