|
Notes:
Libxslt-ruby includes the following changes:
* Ability to reuse the same stylesheet multiple times
* Simpler api
* Compatibility layer for pre-0.7.0 versions
* Major rewrite, resulting in significantly less code
* Updated RDocs.
To see the difference, here is the new API:
stylesheet_doc = XML::Document.file('stylesheet_file')
stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
xml_doc = XML::Document.file('xml_file')
result_doc = stylesheet.apply(xml_doc)
And here is the old way:
xsl_file = File.expand_path('files/fuzface.xsl')
xslt = XML::XSLT.file(xsl_file)
xml_file = File.expand_path('files/fuzface.xml')
xslt.doc = XML::Document.file(xml_file)
stylesheet = xslt.parse
result_string = stylesheet.apply(xml_doc)
The old API had a number of issues:
* The XSLT namespace was nested in XML - that seems like a bad idea now that libxslt is its own gem
* Stylesheets could only be opened from files
* A stylesheet could only be used once
* A needless parse call was required
* The result of the apply transformation was returned as a string
Note this release includes a module that provides backwards compatibility - it will be removed in future releases.
Changes:
|