Class: Saxon::XPath::StaticContext::DSL Private
- Inherits:
-
Object
- Object
- Saxon::XPath::StaticContext::DSL
- Includes:
- Common
- Defined in:
- lib/saxon/xpath/static_context.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the hooks for constructing a Saxon::XPath::StaticContext with a DSL.
Class Method Summary collapse
-
.define(block, args = {}) ⇒ Saxon::XPath::StaticContext
private
Create an instance based on the args hash, and execute the passed in Proc/lambda against it using
#instance_execand return a new Saxon::XPath::StaticContext with the results.
Instance Method Summary collapse
-
#default_collation(collation_uri) ⇒ Object
private
Set the default Collation to use.
-
#namespace(namespaces = {}) ⇒ Object
private
Bind prefixes to namespace URIs.
-
#variable(qname, type = nil) ⇒ Object
private
Declare a XPath variable’s existence in the context.
Methods included from Common
Class Method Details
.define(block, args = {}) ⇒ Saxon::XPath::StaticContext
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::XPath::StaticContext with the results
53 54 55 56 57 |
# File 'lib/saxon/xpath/static_context.rb', line 53 def self.define(block, args = {}) dsl = new(args) dsl.instance_exec(&block) unless block.nil? StaticContext.new(dsl.args_hash) end |
Instance Method Details
#default_collation(collation_uri) ⇒ Object
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.
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.
65 66 67 |
# File 'lib/saxon/xpath/static_context.rb', line 65 def default_collation(collation_uri) @default_collation = collation_uri end |
#namespace(namespaces = {}) ⇒ Object
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.
Bind prefixes to namespace URIs
72 73 74 |
# File 'lib/saxon/xpath/static_context.rb', line 72 def namespace(namespaces = {}) @declared_namespaces = @declared_namespaces.merge(namespaces.transform_keys(&:to_s)).freeze end |
#variable(qname, type = nil) ⇒ Object
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.
Declare a XPath variable’s existence in the context
explicit QName or prefix:name string form. The string form requires the namespace prefix to have already been declared with #namespace variable, either as a string using the same form as an XSLT as="" type definition, or as a hash of one key/value where that key is a Symbol taken from OccurenceIndicator and the value is either a Class that ItemType can convert to its XDM equivalent (e.g. String), or a string that ItemType can parse into an XDM type (e.g. xs:string</tthat {Saxon::ItemType} can parse into an XDM type (e.g. <tt>xs:string or element()). If it’s nil, then the default item()* – anything – type declaration is used
91 92 93 94 95 96 |
# File 'lib/saxon/xpath/static_context.rb', line 91 def variable(qname, type = nil) qname = resolve_variable_qname(qname) @declared_variables = @declared_variables.merge({ qname => resolve_variable_declaration(qname, type) }).freeze end |