= libxslt-ruby
== Overview
The libxslt gem provides Ruby language bindings for GNOME's Libxslt
toolkit. It is free software, released under the MIT License.
== Requirements
libxslt-ruby requires Ruby 1.8.4 or higher. It is dependent on
the following libraries to function properly:
* libm (math routines: very standard)
* libz (zlib)
* libiconv
* libxml2
* libxslt
* libxml-ruby bindings
If you are running Linux or Unix you'll need a C compiler so the extension
can be compiled when it is installed. If you are running Windows, then install the Windows specific RubyGem which
includes an already built extension.
!!!NOTE!!! The libxml-ruby and libxslt-ruby bindings must absolutely, positively,
without a doubt share the same libxml2 library. This is because libxslt modifies
XML documents created by libxml2. If there are two copies of libxml2 on your
system, then when XML documents allocated in copy #1 are manipulated by copy #2,
a segmentation fault will occur. So make sure that your system has only one copy of libxml2
installed.
== INSTALLATION
The easiest way to install libxslt-ruby is via Ruby Gems. To install:
gem install libxslt-ruby
If you are running Windows, make sure to install the Win32 RubyGem which
includes an already built binary file. The binary is built against
libxml2 version 2.6.32, iconv version 1.12 and libxslt version 1.1.24.
Binaries for libxml2 and iconv are provided in the libxml-ruby bindings,
while a binary for libxslt is provided in the libxslt-ruby bindings.
These binaries should be put either in the libxslt/lib directory
or on the Windows path.
The Windows binaries are biult with MingW. The gem also includes
a Microsoft VC++ 2005 solution. If you wish to run a debug version
of libxml-ruby on Windows, then it is highly recommended
you use VC++.
== USAGE
Given an XML file like:
Sean
Chittenden
sean@chittenden.org
$Version$
$Date: 2008-07-10 00:39:47 -0600 (Thu, 10 Jul 2008) $
$Id: README 64 2008-07-10 06:39:47Z cfis $ Fuzface...
The Internet's a big place and here's some proof...
I think it's a tragedy that I'm going to start off my new
commentary by talking about facial hair and the Internet.
Something about that just screams pathetic, but whatever: it's
humor and that's life.
And an XSLT file like this:
Ramblings - -
By:
Date:
We can easily transform the XML with the following ruby code:
require 'libxslt'
# Create a new XSL Transform
stylesheet_doc = XML::Document.file('files/fuzface.xsl')
stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
# Transform a xml document
xml_doc = XML::Document.file('files/fuzface.xml')
result = stylesheet.apply(xml_doc)
You can then print, save or manipulate the returned document.
== License
See LICENSE for license information.
== DOCUMENTATION
RDoc comments are included - run 'rake doc' to generate documentation.
You can find the latest documentation at:
* http://libxsl.rubyforge.org/
== MORE INFORMATION
For more information please refer to the documentation. If you have any
questions, please send email to libxml-devel@rubyforge.org.