Class LibXSLT::XSLT::Stylesheet
In: ext/libxslt/ruby_xslt_stylesheet.c
Parent: Object

The XSLT::Stylesheet represents a XSL stylesheet that can be used to transform an XML document. For usage information refer to XSLT::Stylesheet#apply

Methods

apply   new  

Public Class methods

Creates a new XSLT stylesheet based on the specified document. For memory management reasons, a copy of the specified document will be made, so its best to create a single copy of a stylesheet and use it multiple times.

 stylesheet_doc = XML::Document.file('stylesheet_file')
 stylesheet = XSLT::Stylesheet.new(stylesheet_doc)

[Source]

/* call-seq:
 *    XSLT::Stylesheet.new(document) -> XSLT::Stylesheet
 * 
 * Creates a new XSLT stylesheet based on the specified document.
 * For memory management reasons, a copy of the specified document
 * will be made, so its best to create a single copy of a stylesheet
 * and use it multiple times.
 *
 *  stylesheet_doc = XML::Document.file('stylesheet_file')
 *  stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
 *
 */
VALUE
ruby_xslt_stylesheet_initialize(VALUE self, VALUE document) {

Public Instance methods

Apply this stylesheet transformation to the provided document. This method may be invoked multiple times.

Params:

  • document - An instance of an XML::Document
  • params - An optional hash table that specifies the values for xsl:param values embedded in the stylesheet.

Example:

 stylesheet_doc = XML::Document.file('stylesheet_file')
 stylesheet = XSLT::Stylesheet.new(stylesheet_doc)

 xml_doc = XML::Document.file('xml_file')
 result = stylesheet.apply(xml_doc)
 result = stylesheet.apply(xml_doc, {:foo => 'bar'})

[Source]

/* call-seq: 
 *   stylesheet.apply(document, {params}) -> XML::Document
 * 
 * Apply this stylesheet transformation to the provided document.
 * This method may be invoked multiple times.
 *
 * Params:
 * *  document - An instance of an XML::Document
 * *  params - An optional hash table that specifies the values for xsl:param values embedded in the stylesheet.
 *
 * Example:
 * 
 *  stylesheet_doc = XML::Document.file('stylesheet_file')
 *  stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
 *
 *  xml_doc = XML::Document.file('xml_file')
 *  result = stylesheet.apply(xml_doc)
 *  result = stylesheet.apply(xml_doc, {:foo => 'bar'})
 */
VALUE
ruby_xslt_stylesheet_apply(int argc, VALUE *argv, VALUE self) {

[Validate]