Class: Saxon::XSLT::EvaluationContext::DSL
- Inherits:
-
Object
- Object
- Saxon::XSLT::EvaluationContext::DSL
- Includes:
- Common
- Defined in:
- lib/saxon/xslt/evaluation_context.rb
Overview
Provides the hooks for constructing a Saxon::XSLT::EvaluationContext with a DSL.
Class Method Summary collapse
-
.define(block, args = {}) ⇒ Saxon::XSLT::EvaluationContext
private
Create an instance based on the args hash, and execute the passed in Proc/lambda against it using
#instance_exec
and return a new Saxon::XSLT::EvaluationContext with the results.
Instance Method Summary collapse
-
#default_collation(collation_uri) ⇒ Object
Set the default Collation to use.
-
#global_parameters(parameters = {}) ⇒ Object
Set the values for global parameters (those that are available to all templates and functions).
-
#initial_template_parameters(parameters = {}) ⇒ Object
Set the values for parameters made available only to the initial template invoked (either via apply_templates or call_template), effectively as if
<xsl:with-param tunnel="no">
was being used. -
#initial_template_tunnel_parameters(parameters = {}) ⇒ Object
Set the values for tunneling parameters made available only to the initial template invoked (either via apply_templates or call_template), effectively as if
<xsl:with-param tunnel="yes">
was being used. -
#static_parameters(parameters = {}) ⇒ Object
Set the value for static parameters (those that must be known at compile-time to avoid an error), as a hash of QName => Value pairs.
Methods included from Common
Class Method Details
.define(block, args = {}) ⇒ Saxon::XSLT::EvaluationContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create an instance based on the args hash, and execute the passed in Proc/lambda against it using #instance_exec
and return a new Saxon::XSLT::EvaluationContext with the results
61 62 63 64 65 |
# File 'lib/saxon/xslt/evaluation_context.rb', line 61 def self.define(block, args = {}) dsl = new(args) dsl.instance_exec(&block) unless block.nil? EvaluationContext.new(dsl.args_hash) end |
Instance Method Details
#default_collation(collation_uri) ⇒ Object
Set the default Collation to use. This should be one of the special collation URIs Saxon recognises, or one that has been registered using Saxon::Processor#declare_collations on the Processor that created the Compiler this context is for.
73 74 75 |
# File 'lib/saxon/xslt/evaluation_context.rb', line 73 def default_collation(collation_uri) @default_collation = collation_uri end |
#global_parameters(parameters = {}) ⇒ Object
Set the values for global parameters (those that are available to all templates and functions).
98 99 100 |
# File 'lib/saxon/xslt/evaluation_context.rb', line 98 def global_parameters(parameters = {}) @global_parameters = @global_parameters.merge(process_parameters(parameters)).freeze end |
#initial_template_parameters(parameters = {}) ⇒ Object
Set the values for parameters made available only to the initial template invoked (either via apply_templates or call_template), effectively as if <xsl:with-param tunnel="no">
was being used.
110 111 112 |
# File 'lib/saxon/xslt/evaluation_context.rb', line 110 def initial_template_parameters(parameters = {}) @initial_template_parameters = @initial_template_parameters.merge(process_parameters(parameters)) end |
#initial_template_tunnel_parameters(parameters = {}) ⇒ Object
Set the values for tunneling parameters made available only to the initial template invoked (either via apply_templates or call_template), effectively as if <xsl:with-param tunnel="yes">
was being used.
122 123 124 |
# File 'lib/saxon/xslt/evaluation_context.rb', line 122 def initial_template_tunnel_parameters(parameters = {}) @initial_template_tunnel_parameters = @initial_template_tunnel_parameters.merge(process_parameters(parameters)) end |
#static_parameters(parameters = {}) ⇒ Object
Set the value for static parameters (those that must be known at compile-time to avoid an error), as a hash of QName => Value pairs. Parameter QNames can be declared as Strings or Symbols if they are not in any namespace, otherwise an explicit QName must be used. Values can be provided as explicit XDM::Values: Saxon::XDM::Value, Saxon::XDM::Node, and Saxon::XDM::AtomicValue, or as Ruby objects which will be converted to Saxon::XDM::AtomicValues in the usual way.
88 89 90 |
# File 'lib/saxon/xslt/evaluation_context.rb', line 88 def static_parameters(parameters = {}) @static_parameters = @static_parameters.merge(process_parameters(parameters)).freeze end |