← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1189792 into lp:zorba

 

Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-1189792 into lp:zorba.

Commit message:
Updated this core module to "the new way."
Added "functions()" function.

Requested reviews:
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #1189792 in Zorba: "Update core module "sctx""
  https://bugs.launchpad.net/zorba/+bug/1189792

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189792/+merge/188504

Updated this core module to "the new way."
Added "functions()" function.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1189792/+merge/188504
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-09-22 17:52:24 +0000
+++ ChangeLog	2013-10-01 03:26:58 +0000
@@ -75,6 +75,7 @@
   * Fixed bug #1190407 (wrong rewrite of if-then-else return clause in case
     of general flwor)
   * Fixed bug #1188281 (casting to xs:anySimpleType not allowed)
+  * Fixed bug #1189792 (Update core module "sctx")
   * jn:members function takes item()* as aparameter (instead of item())
   * Fixed bug #1188095 (do correct normalization for fn:string-length()))
   * jn:keys function takes item()* as aparameter (instead of item())

=== modified file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt	2013-09-19 14:00:22 +0000
+++ modules/CMakeLists.txt	2013-10-01 03:26:58 +0000
@@ -13,19 +13,24 @@
 # limitations under the License.
 
 ADD_SUBDIRECTORY(atomic)
-ADD_SUBDIRECTORY(store)
 ADD_SUBDIRECTORY(com)
-ADD_SUBDIRECTORY(org)
+ADD_SUBDIRECTORY(full-text)
 ADD_SUBDIRECTORY(functx)
-ADD_SUBDIRECTORY(zorba-query)
-ADD_SUBDIRECTORY(w3c)
-ADD_SUBDIRECTORY(full-text)
-ADD_SUBDIRECTORY(xml)
 ADD_SUBDIRECTORY(http-client)
+ADD_SUBDIRECTORY(item)
 ADD_SUBDIRECTORY(json)
+ADD_SUBDIRECTORY(org)
+ADD_SUBDIRECTORY(sctx)
+ADD_SUBDIRECTORY(store)
 ADD_SUBDIRECTORY(structured-items)
+<<<<<<< TREE
 ADD_SUBDIRECTORY(item)
 ADD_SUBDIRECTORY(schema)
+=======
+ADD_SUBDIRECTORY(w3c)
+ADD_SUBDIRECTORY(xml)
+ADD_SUBDIRECTORY(zorba-query)
+>>>>>>> MERGE-SOURCE
 
 
 # Add external module projects - any subdirectories of a directory

=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt	2013-09-10 20:37:34 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt	2013-10-01 03:26:58 +0000
@@ -27,8 +27,6 @@
   URI "http://www.zorba-xquery.com/modules/xqdoc-options";) 
 
 # Subdirectories
-DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0
-  URI "http://www.zorba-xquery.com/modules/introspection/sctx";)
 
 DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.0
   URI "http://www.zorba-xquery.com/modules/store/dynamic/documents";)

=== removed directory 'modules/com/zorba-xquery/www/modules/introspection'
=== added directory 'modules/sctx'
=== added file 'modules/sctx/CMakeLists.txt'
--- modules/sctx/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ modules/sctx/CMakeLists.txt	2013-10-01 03:26:58 +0000
@@ -0,0 +1,18 @@
+# Copyright 2006-2012 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DECLARE_ZORBA_MODULE(FILE sctx.jq VERSION 1.0
+  URI "http://zorba.io/modules/sctx";)
+
+# vim:set et sw=2 ts=2:

=== renamed file 'modules/com/zorba-xquery/www/modules/introspection/sctx.xq' => 'modules/sctx/sctx.jq'
--- modules/com/zorba-xquery/www/modules/introspection/sctx.xq	2013-08-09 08:27:30 +0000
+++ modules/sctx/sctx.jq	2013-10-01 03:26:58 +0000
@@ -1,7 +1,7 @@
-xquery version "1.0";
+jsoniq version "1.0";
 
 (:
- : Copyright 2006-2009 The FLWOR Foundation.
+ : Copyright 2006-2013 The FLWOR Foundation.
  :
  : Licensed under the Apache License, Version 2.0 (the "License");
  : you may not use this file except in compliance with the License.
@@ -17,270 +17,279 @@
 :)
 
 (:~
- : Intospection Module for the Static Context components.
+ : This module provides functions that gets components of the static context.
  :
  : @see http://www.w3.org/TR/xquery/#id-xq-static-context-components
- :
  : @author Nicolae Brinza
- : @project Zorba/Introspection/Static Context
- :
+ : @project Zorba/Static Context
  :)
-
-module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare namespace ver = "http://zorba.io/options/versioning";;
-declare option ver:module-version "2.0";
-
-(:~
- : The function returns a list of known statically known namespaces as prefixes
- : (fn, xml, xs, xsi, etc).
- : @return A sequence of xs:strings, one for each known namespace prefix.
- :
- : @see http://www.w3.org/TR/xquery/#dt-static-namespaces
- :)
-declare function sctx:statically-known-namespaces() as xs:string* external;
-
-(:~
- : For any statically know namespace prefix, the bound URI can be retrieved
- : with the statically-known-namespace-bindings() function.
- :
- : @param $prefix The prefix of the known namespace, for which the bound URI
- : is being requested.
- : @return The URI bound to the prefix is returned, or an empty sequence if
- : the prefix is not known.
- :
- : @see http://www.w3.org/TR/xquery/#dt-static-namespaces
- :)
-declare function sctx:statically-known-namespace-binding($prefix as xs:string) as xs:string? external;
-
-(:~
- : The function returns the URI of the default function namespace.
- :
- : @return The URI of the of the default function namespace.
- :
- : @see http://www.w3.org/TR/xquery/#dt-def-fn-ns
- :)
-declare function sctx:default-function-namespace() as xs:string external;
-
-(:~
- : The function returns the base URI.
+declare option ver:module-version "3.0";
+
+(:~
+ : Gets the base URI.
  :
  : @return The base URI.
- :
  : @see http://www.w3.org/TR/xquery/#dt-base-uri
  :)
-declare function sctx:base-uri() as xs:string? external;
-
-(:~
- : The function returns the statically known default collection type. This
- : is the type of the sequence of nodes that would result from calling the
- : fn:collection function with no arguments.
+declare function sctx:base-uri()
+  as xs:string? external;
+
+(:~
+ : Gets the boundary whitespace policy used by direct element constructors.
+ :
+ : @return Either <code>preserve</code> or <code>strip</code>.
+ : @see http://www.w3.org/TR/xquery/#dt-boundary-space-policy
+ :)
+declare function sctx:boundary-space-policy()
+  as xs:string external;
+
+(:~
+ : Gets the static context construction mode of element and document nodes.
+ :
+ : @return Either <code>preserve</code> or <code>strip</code>.
+ : @see http://www.w3.org/TR/xquery/#dt-construction-mode
+ :)
+declare function sctx:construction-mode()
+  as xs:string external;
+
+(:~
+ : Gets the static context components that control the the namespace bindings
+ : that are assigned when an existing element node is copied
+ : by an element constructor.
+ :
+ : @return A sequence of two strings:
+ : the first is either <code>preserve</code> or <code>no-preserve</code>
+ : and the second is either <code>inherit</code> or <code>no-inherit</code>.
+ : @see http://www.w3.org/TR/xquery/#dt-copy-namespaces-mode
+ :)
+declare function sctx:copy-namespaces-mode()
+  as xs:string+ external;
+
+(:~
+ : Gets one of statically known collations used by functions and operators
+ : for comparing and ordering values of type <code>xs:string</code>
+ : or <code>xs:anyURI</code> when no explicit collation is specified.
+ :
+ : @return The collations that is used by default.
+ : @see http://www.w3.org/TR/xquery/#dt-def-collation
+ :)
+declare function sctx:default-collation()
+  as xs:string external;
+
+(:~
+ : Gets the statically known default collection type.
+ : This is the type of the sequence of nodes that would result from calling the
+ : <code>fn:collection</code> function with no arguments.
  :
  : @return The type of the default collection.
- :
  : @see http://www.w3.org/TR/xquery/#dt-known-default-collection
  :)
-declare function sctx:default-collection-type() as xs:string external;
-
-(:~
- : The function return a sequence of QNames identifying declared variables
- : from the static context.
- :
- : @return A sequence of QNames, one for each variable.
- :
- : @see http://www.w3.org/TR/xquery/#dt-in-scope-variables
- :)
-declare function sctx:in-scope-variables() as xs:QName* external;
-
-(:~
- : The function returns a sequence of QNames identifying in-scope schema types,
- : including all the predefined schema types and all definitions found in
- : imported schemas.
- :
- : @return A sequence of QNames, one for each defined type.
- :
- : @see http://www.w3.org/TR/xquery/#dt-is-types
- :)
-declare function sctx:in-scope-schema-types() as xs:QName* external;
-
-(:~
- : The function return a sequence of QNames identifying declared elements
+declare function sctx:default-collection-type()
+  as xs:string external;
+
+(:~
+ : Gets the URI of the default function namespace.
+ :
+ : @return The URI of the of the default function namespace.
+ : @see http://www.w3.org/TR/xquery/#dt-def-fn-ns
+ :)
+declare function sctx:default-function-namespace()
+  as xs:string external;
+
+(:~
+ : Gets the component that controls the processing of empty sequences and NaN
+ : values as ordering keys in an <code>order by</code> clause
+ : in a FLWOR expression.
+ :
+ : @return Either <code>greatest</code> or <code>least</code>.
+ : @see http://www.w3.org/TR/xquery/#dt-default-empty-order
+ :)
+declare function sctx:default-order()
+  as xs:string external;
+
+(:~
+ : Gets the list of annotations declared for the given function.
+ :
+ : @param $name The name of the function.
+ : @param $arity The number of arguments the function takes.
+ : @return the list of annotations
+ :)
+declare function sctx:function-annotations( $name as xs:QName,
+                                            $arity as xs:integer )
+  as xs:QName* external;
+
+(:~
+ : Gets the number of arguments the given XQuery function takes.
+ :
+ : @param $function A QName identifying a function.
+ : @return Either a sequence of zero or more integers
+ : (one for each overloaded version of the given function)
+ : or an empty sequence if the function is not defined.
+ :
+ : @see http://www.w3.org/TR/xquery/#dt-function-signature
+ :)
+declare function sctx:function-arguments-count( $function as xs:QName )
+  as xs:int* external;
+
+(:~
+ : Gets a sequence containing the QNames of all defined functions
+ : that are available to be called from within an expression.
+ :
+ : @return A sequence for QNames identifying all functions.
+ : @see http://www.w3.org/TR/xquery/#dt-function-signature
+ :)
+declare function sctx:function-names()
+  as xs:QName* external;
+
+(:~
+ : Gets a sequence of JSON objects containing the name, arity, and annotations
+ : of all defined functions that are available to be called form within an
+ : expression.
+ :
+ : @return A sequence of objects.
+ :)
+declare function sctx:functions()
+  as object()* external;
+
+(:~
+ : Gets a sequence of QNames identifying declared attributes
+ : in the imported schemas.
+ :
+ : @return A sequence of QNames, one for each attribute.
+ : @see http://www.w3.org/TR/xquery/#dt-is-attrs
+ :)
+declare function sctx:in-scope-attribute-declarations()
+  as xs:QName* external;
+
+(:~
+ : Gets a sequence of QNames identifying declared in-scope
+ : schema attribute groups.
+ :
+ : @return A sequence of QNames, one for each attribute group.
+ :)
+declare function sctx:in-scope-attribute-groups()
+  as xs:QName* external;
+
+(:~
+ : Gets a sequence of QNames identifying declared elements
  : in the imported schemas.
  :
  : @return A sequence of QNames, one for each declared element.
- :
  : @see http://www.w3.org/TR/xquery/#dt-is-elems
  :)
-declare function sctx:in-scope-element-declarations() as xs:QName* external;
-
-(:~
- : The function return a sequence of QNames identifying declared attributes
- : in the imported schemas.
- :
- : @return A sequence of QNames, one for each attribute.
- :
- : @see http://www.w3.org/TR/xquery/#dt-is-attrs
- :)
-declare function sctx:in-scope-attribute-declarations() as xs:QName* external;
-
-(:~
- : The function returns a sequence of QNames identifying declared in-scope
+declare function sctx:in-scope-element-declarations()
+  as xs:QName* external;
+
+(:~
+ : Gets a sequence of QNames identifying declared in-scope
  : schema element groups.
  :
  : @return A sequence of QNames, one for each element group.
  :)
-declare function sctx:in-scope-element-groups() as xs:QName* external;
-
-(:~
- : The function returns a sequence of QNames identifying declared in-scope
- : schema attribute groups.
- :
- : @return A sequence of QNames, one for each attribute group.
- :)
-declare function sctx:in-scope-attribute-groups() as xs:QName* external;
-
-(:~
- : The function returns a sequence containing the QNames of all defined
- : functions, which are available to be called from within an expression.
- :
- : @return A sequence for QNames identifying all functions.
- :
- : @see http://www.w3.org/TR/xquery/#dt-function-signature
- :)
-declare function sctx:function-names() as xs:QName* external;
-
-(:~
- : The function returns the number of arguments the given XQuery $function
- : takes.
- :
- : @param $function A QName identifying a function.
- : @return A sequence of zero or more integers, one for each overloaded version
- : of the given function. An empty sequence is returned if the function is not
- : defined.
- :
- : @see http://www.w3.org/TR/xquery/#dt-function-signature
- :)
-declare function sctx:function-arguments-count($function as xs:QName) as xs:int* external;
-
-(:~
- : Retrieves the list of annotations declared for the given function.
- :
- : @param $name the name of the function
- : @param $arity the number of arguments the function takes
- : @return the list of annotations
- :)
-declare function sctx:function-annotations($name as xs:QName, $arity as xs:integer) as xs:QName* external;
-
-(:~
- : The function returns true or false depending on whether rules for
- : compatibility with XPath 1.0 are in effect. XQuery set the value
- : of this component to false.
- :
- : @return The function should return false
- :
+declare function sctx:in-scope-element-groups()
+  as xs:QName* external;
+
+(:~
+ : Gets a sequence of QNames identifying in-scope schema types
+ : including all the predefined schema types and all definitions
+ : found in imported schemas.
+ :
+ : @return A sequence of QNames, one for each defined type.
+ : @see http://www.w3.org/TR/xquery/#dt-is-types
+ :)
+declare function sctx:in-scope-schema-types()
+  as xs:QName* external;
+
+(:~
+ : Gets a sequence of QNames identifying declared variables
+ : from the static context.
+ :
+ : @return A sequence of QNames, one for each variable.
+ : @see http://www.w3.org/TR/xquery/#dt-in-scope-variables
+ :)
+declare function sctx:in-scope-variables()
+  as xs:QName* external;
+
+(:~
+ : Gets the value of an option that is declared in the prolog of the module.
+ :
+ : @param $name the name of the option value to retrieve
+ : @return the value of the option if contained in the static context
+ : or the empty sequence otherwise.
+ :)
+declare function sctx:option( $name as xs:QName )
+  as xs:string? external;
+
+(:~
+ : Gets the ordering mode that affects the ordering of the result sequences
+ : returned by certain expressions.
+ :
+ : @return Either <code>ordered</code> or <code>unordered</code>.
+ : @see http://www.w3.org/TR/xquery/#dt-ordering-mode
+ :)
+declare function sctx:ordering-mode() as xs:string external;
+
+(:~
+ : Gets a sequence that contains the statically known collations.
+ :
+ : @return The sequence of collations.
+ : @see http://www.w3.org/TR/xquery/#dt-static-collations
+ :)
+declare function sctx:statically-known-collations()
+  as xs:anyURI* external;
+
+(:~
+ : Gets a sequence that contains the URIs of all statically known documents.
+ :
+ : @return The sequence of document URIs.
+ : @see http://www.w3.org/TR/xquery/#dt-known-docs
+ :)
+declare function sctx:statically-known-documents()
+  as xs:anyURI* external;
+
+(:~
+ : For the given document, returns the static type of its root node.
+ :
+ : @param $document A URI of a document.
+ : @return The static type of the given document.
+ : @see http://www.w3.org/TR/xquery/#dt-known-docs
+ :)
+declare function sctx:statically-known-document-type( $document as xs:string )
+  as xs:QName external;
+
+(:~
+ : Gets the bound URI for the given prefix.
+ :
+ : @param $prefix The prefix of the known namespace for which the bound URI
+ : is being requested.
+ : @return The URI bound to the prefix is returned, or an empty sequence if
+ : the prefix is not known.
+ : @see http://www.w3.org/TR/xquery/#dt-static-namespaces
+ :)
+declare function sctx:statically-known-namespace-binding( $prefix as xs:string )
+  as xs:string? external;
+
+(:~
+ : Gets a list of known statically known namespaces as prefixes
+ : (fn, xml, xs, xsi, etc).
+ :
+ : @return A sequence of xs:strings, one for each known namespace prefix.
+ : @see http://www.w3.org/TR/xquery/#dt-static-namespaces
+ :)
+declare function sctx:statically-known-namespaces()
+  as xs:string* external;
+
+(:~
+ : Gets true or false depending on whether rules for compatibility
+ : with XPath 1.0 are in effect.
+ : XQuery set the value of this component to false.
+ :
+ : @return The function should return <code>false</code>.
  : @see http://www.w3.org/TR/xquery/#dt-xpath-compat-mode
  :)
 declare function sctx:xpath10-compatibility-mode() as xs:boolean external;
 
-(:~
- : The function returns one of statically known collations that is used by
- : functions and operators for comparing and ordering values of type xs:string
- : or xs:anyURI when no explicit collation is specified.
- :
- : @return The collations that is used by default.
- :
- : @see http://www.w3.org/TR/xquery/#dt-def-collation
- :)
-declare function sctx:default-collation() as xs:string external;
-
-(:~
-  : The function returns a sequence that contains the URIs of all statically known documents.
-  :
-  : @return The sequence of document URIs.
-  :
-  : @see http://www.w3.org/TR/xquery/#dt-known-docs
-  :)
-declare function sctx:statically-known-documents() as xs:anyURI* external;
-
-(:~
-  : For the given document, the function returns the static type of its root node.
-  :
-  : @param $document An URI of a document.
-  : @return The static type of the given document.
-  :
-  : @see http://www.w3.org/TR/xquery/#dt-known-docs
-  :)
-declare function sctx:statically-known-document-type($document as xs:string) as xs:QName external;
-
-(:~
- : The function returns a sequence that contains the statically known collations.
- :
- : @return The sequence of collations.
- :
- : @see http://www.w3.org/TR/xquery/#dt-static-collations
- :)
-declare function sctx:statically-known-collations() as xs:anyURI* external;
-
-(:~
- : The function returns the static context construction mode of element and
- : document nodes.
- :
- : @return Either "preserve" or "strip", as strings.
- :
- : @see http://www.w3.org/TR/xquery/#dt-construction-mode
- :)
-declare function sctx:construction-mode() as xs:string external;
-
-(:~
- : The function returns the static context ordering mode, which affects the
- : ordering of the result sequences returned by certain expressions.
- :
- : @return Either "ordered" or "unordered", as strings.
- :
- : @see http://www.w3.org/TR/xquery/#dt-ordering-mode
- :)
-declare function sctx:ordering-mode() as xs:string external;
-
-(:~
- : The function returns the static context component which controls the
- : processing of empty sequences and NaN values as ordering keys in an order
- : by clause in a FLWOR expression.
- :
- : @return Either "greatest" or "least", as strings.
- :
- : @see http://www.w3.org/TR/xquery/#dt-default-empty-order
- :)
-declare function sctx:default-order() as xs:string external;
-
-(:~
- : The function returns the static context component which controls the
- : processing of boundary whitespace by direct element constructors.
- :
- : @return Either "preserve" or "strip", as strings.
- :
- : @see http://www.w3.org/TR/xquery/#dt-boundary-space-policy
- :)
-declare function sctx:boundary-space-policy() as xs:string external;
-
-(:~
- : The function returns the static context components which control the
- : the namespace bindings that are assigned when an existing element node
- : is copied by an element constructor
- :
- : @return A sequence containing exactly two strings, of which the first
- : has a value of either "preserve" or "no-preserve" and the second a value
- : of either "inherit" or "no-inherit".
- :
- : @see http://www.w3.org/TR/xquery/#dt-copy-namespaces-mode
- :)
-declare function sctx:copy-namespaces-mode() as xs:string+ external;
-
-(:~
- : Retrieves the value of an option that is declared in the prolog
- : of the module.
- :
- : @param $name the name of the option value to retrieve
- : @return the value of the option if contained in the static context
- :         or the empty sequence otherwise.
- :)
-declare function sctx:option($name as xs:QName) as xs:string? external;
+(: vim:set syntax=xquery et sw=2 ts=2: :)

=== modified file 'src/annotations/annotations.cpp'
--- src/annotations/annotations.cpp	2013-07-25 14:10:17 +0000
+++ src/annotations/annotations.cpp	2013-10-01 03:26:58 +0000
@@ -346,7 +346,7 @@
 /*******************************************************************************
 
 ********************************************************************************/
-AnnotationInternal* AnnotationList::get(csize index) const
+AnnotationInternal* AnnotationList::get(size_type index) const
 {
   if (index < theAnnotationList.size())
     return theAnnotationList[index];

=== modified file 'src/annotations/annotations.h'
--- src/annotations/annotations.h	2013-07-06 06:59:32 +0000
+++ src/annotations/annotations.h	2013-10-01 03:26:58 +0000
@@ -164,6 +164,8 @@
 
   typedef std::vector<AnnotationInternal*> Annotations;
 
+  typedef Annotations::size_type size_type;
+
 protected:
   Annotations theAnnotationList;
 
@@ -177,9 +179,9 @@
 
   ~AnnotationList();
 
-  csize size() const { return theAnnotationList.size(); }
+  size_type size() const { return theAnnotationList.size(); }
 
-  AnnotationInternal* get(csize index) const;
+  AnnotationInternal* get(size_type index) const;
 
   AnnotationInternal* get(AnnotationInternal::AnnotationId id) const;
 

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2013-09-19 14:00:22 +0000
+++ src/context/static_context.cpp	2013-10-01 03:26:58 +0000
@@ -434,8 +434,8 @@
 "http://zorba.io/modules/random";;
 
 const char*
-static_context::ZORBA_INTROSP_SCTX_FN_NS =
-"http://www.zorba-xquery.com/modules/introspection/sctx";;
+static_context::ZORBA_SCTX_FN_NS =
+"http://zorba.io/modules/sctx";;
 
 const char*
 static_context::ZORBA_REFLECTION_FN_NS =
@@ -551,7 +551,7 @@
             ns == ZORBA_SCHEMA_FN_NS ||
             ns == ZORBA_XQDOC_FN_NS ||
             ns == ZORBA_RANDOM_FN_NS ||
-            ns == ZORBA_INTROSP_SCTX_FN_NS ||
+            ns == ZORBA_SCTX_FN_NS ||
             ns == ZORBA_REFLECTION_FN_NS ||
             ns == ZORBA_SCRIPTING_FN_NS ||
             ns == ZORBA_STRING_FN_NS ||
@@ -619,7 +619,7 @@
       ns.compare(0, strlen(ZORBA_IO_NS_PREFIX), ZORBA_IO_NS_PREFIX) == 0)
   {
     return (ns == ZORBA_MATH_FN_NS ||
-            ns == ZORBA_INTROSP_SCTX_FN_NS ||
+            ns == ZORBA_SCTX_FN_NS ||
             ns == ZORBA_JSON_CSV_FN_NS ||
             ns == ZORBA_JSON_XML_FN_NS ||
             ns == ZORBA_XQDOC_FN_NS ||

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2013-09-17 23:05:29 +0000
+++ src/context/static_context.h	2013-10-01 03:26:58 +0000
@@ -541,7 +541,7 @@
   static const char* ZORBA_SCHEMA_FN_NS;
   static const char* ZORBA_XQDOC_FN_NS;
   static const char* ZORBA_RANDOM_FN_NS;
-  static const char* ZORBA_INTROSP_SCTX_FN_NS;
+  static const char* ZORBA_SCTX_FN_NS;
   static const char* ZORBA_REFLECTION_FN_NS;
   static const char* ZORBA_STRING_FN_NS;
 

=== modified file 'src/functions/pregenerated/func_sctx.cpp'
--- src/functions/pregenerated/func_sctx.cpp	2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_sctx.cpp	2013-10-01 03:26:58 +0000
@@ -23,7 +23,7 @@
 
 
 #include "stdafx.h"
-#include "runtime/introspection/sctx.h"
+#include "runtime/sctx/sctx.h"
 #include "functions/func_sctx.h"
 
 
@@ -31,27 +31,7 @@
 
 
 
-PlanIter_t fn_zorba_introspect_sctx_statically_known_namespaces::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new StaticNamespacesIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_default_function_namespace::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new DefaultFunctionNamespaceIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_base_uri::codegen(
+PlanIter_t fn_zorba_sctx_base_uri::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -61,7 +41,37 @@
   return new SctxBaseUriIterator(sctx, loc, argv);
 }
 
-PlanIter_t fn_zorba_introspect_sctx_default_collation::codegen(
+PlanIter_t fn_zorba_sctx_boundary_space_policy::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxBoundarySpacePolicyIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_construction_mode::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxConstructionModeIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_copy_namespaces_mode::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxCopyNamespacesModeIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_default_collation::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -71,214 +81,214 @@
   return new SctxDefaultCollationIterator(sctx, loc, argv);
 }
 
-PlanIter_t fn_zorba_introspect_sctx_statically_known_namespace_binding::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new StaticNamespaceBindingIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_in_scope_variables::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new InscopeVariablesIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_default_collection_type::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new DefaultCollectionTypeIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_xpath10_compatibility_mode::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new XPath10CompatModeIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_statically_known_documents::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new StaticallyKnownDocumentsIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_statically_known_document_type::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new StaticallyKnownDocumentTypeIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_statically_known_collations::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new StaticallyKnownCollationsIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_construction_mode::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new ConstructionModeIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_ordering_mode::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new OrderingModeIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_default_order::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new DefaultOrderIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_boundary_space_policy::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new BoundarySpacePolicyIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_copy_namespaces_mode::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new CopyNamespacesModeIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_function_names::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new FunctionNamesIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_function_arguments_count::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new FunctionArgumentsCountIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_in_scope_schema_types::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new InScopeSchemaTypesIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_in_scope_element_declarations::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new InScopeElementDeclarationsIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_in_scope_attribute_declarations::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new InScopeAttributeDeclarationsIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_in_scope_element_groups::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new InScopeElementGroupsIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_in_scope_attribute_groups::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new InScopeAttributeGroupsIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_option::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new OptionIterator(sctx, loc, argv);
-}
-
-PlanIter_t fn_zorba_introspect_sctx_function_annotations::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new FunctionAnnotationsIterator(sctx, loc, argv);
+PlanIter_t fn_zorba_sctx_default_collection_type::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxDefaultCollectionTypeIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_default_function_namespace::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxDefaultFunctionNamespaceIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_default_order::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxDefaultOrderIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_function_annotations::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxFunctionAnnotationsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_function_arguments_count::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxFunctionArgumentsCountIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_function_names::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxFunctionNamesIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_functions::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxFunctionsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_in_scope_attribute_declarations::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxInScopeAttributeDeclarationsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_in_scope_attribute_groups::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxInScopeAttributeGroupsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_in_scope_element_declarations::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxInScopeElementDeclarationsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_in_scope_element_groups::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxInScopeElementGroupsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_in_scope_schema_types::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxInScopeSchemaTypesIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_in_scope_variables::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxInscopeVariablesIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_option::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxOptionIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_ordering_mode::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxOrderingModeIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_statically_known_collations::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxStaticallyKnownCollationsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_statically_known_documents::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxStaticallyKnownDocumentsIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_statically_known_document_type::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxStaticallyKnownDocumentTypeIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_statically_known_namespace_binding::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxStaticallyKnownNamespaceBindingIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_statically_known_namespaces::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxStaticallyKnownNamespacesIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_sctx_xpath10_compatibility_mode::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new SctxXPath10CompatModeIterator(sctx, loc, argv);
 }
 
 void populate_context_sctx(static_context* sctx)
@@ -286,280 +296,291 @@
 
 
       {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_statically_known_namespaces,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","statically-known-namespaces";), 
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_base_uri,
+        (createQName("http://zorba.io/modules/sctx","","base-uri";), 
+        GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
+        FunctionConsts::FN_ZORBA_SCTX_BASE_URI_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_boundary_space_policy,
+        (createQName("http://zorba.io/modules/sctx","","boundary-space-policy";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_BOUNDARY_SPACE_POLICY_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_construction_mode,
+        (createQName("http://zorba.io/modules/sctx","","construction-mode";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_CONSTRUCTION_MODE_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_copy_namespaces_mode,
+        (createQName("http://zorba.io/modules/sctx","","copy-namespaces-mode";), 
+        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
+        FunctionConsts::FN_ZORBA_SCTX_COPY_NAMESPACES_MODE_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_default_collation,
+        (createQName("http://zorba.io/modules/sctx","","default-collation";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_DEFAULT_COLLATION_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_default_collection_type,
+        (createQName("http://zorba.io/modules/sctx","","default-collection-type";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_DEFAULT_COLLECTION_TYPE_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_default_function_namespace,
+        (createQName("http://zorba.io/modules/sctx","","default-function-namespace";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_DEFAULT_FUNCTION_NAMESPACE_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_default_order,
+        (createQName("http://zorba.io/modules/sctx","","default-order";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_DEFAULT_ORDER_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_function_annotations,
+        (createQName("http://zorba.io/modules/sctx","","function-annotations";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+        GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_FUNCTION_ANNOTATIONS_2);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_function_arguments_count,
+        (createQName("http://zorba.io/modules/sctx","","function-arguments-count";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+        GENV_TYPESYSTEM.INT_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_FUNCTION_ARGUMENTS_COUNT_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_function_names,
+        (createQName("http://zorba.io/modules/sctx","","function-names";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_FUNCTION_NAMES_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_functions,
+        (createQName("http://zorba.io/modules/sctx","","functions";), 
+        GENV_TYPESYSTEM.JSON_OBJECT_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_FUNCTIONS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_in_scope_attribute_declarations,
+        (createQName("http://zorba.io/modules/sctx","","in-scope-attribute-declarations";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_IN_SCOPE_ATTRIBUTE_DECLARATIONS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_in_scope_attribute_groups,
+        (createQName("http://zorba.io/modules/sctx","","in-scope-attribute-groups";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_IN_SCOPE_ATTRIBUTE_GROUPS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_in_scope_element_declarations,
+        (createQName("http://zorba.io/modules/sctx","","in-scope-element-declarations";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_IN_SCOPE_ELEMENT_DECLARATIONS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_in_scope_element_groups,
+        (createQName("http://zorba.io/modules/sctx","","in-scope-element-groups";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_IN_SCOPE_ELEMENT_GROUPS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_in_scope_schema_types,
+        (createQName("http://zorba.io/modules/sctx","","in-scope-schema-types";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_IN_SCOPE_SCHEMA_TYPES_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_in_scope_variables,
+        (createQName("http://zorba.io/modules/sctx","","in-scope-variables";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_IN_SCOPE_VARIABLES_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_option,
+        (createQName("http://zorba.io/modules/sctx","","option";), 
+        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+        GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
+        FunctionConsts::FN_ZORBA_SCTX_OPTION_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_ordering_mode,
+        (createQName("http://zorba.io/modules/sctx","","ordering-mode";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_ORDERING_MODE_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_statically_known_collations,
+        (createQName("http://zorba.io/modules/sctx","","statically-known-collations";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_STATICALLY_KNOWN_COLLATIONS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_statically_known_documents,
+        (createQName("http://zorba.io/modules/sctx","","statically-known-documents";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_STAR),
+        FunctionConsts::FN_ZORBA_SCTX_STATICALLY_KNOWN_DOCUMENTS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_statically_known_document_type,
+        (createQName("http://zorba.io/modules/sctx","","statically-known-document-type";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.QNAME_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_SCTX_STATICALLY_KNOWN_DOCUMENT_TYPE_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_statically_known_namespace_binding,
+        (createQName("http://zorba.io/modules/sctx","","statically-known-namespace-binding";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
+        FunctionConsts::FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_statically_known_namespaces,
+        (createQName("http://zorba.io/modules/sctx","","statically-known-namespaces";), 
         GENV_TYPESYSTEM.STRING_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_NAMESPACES_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_default_function_namespace,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","default-function-namespace";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_DEFAULT_FUNCTION_NAMESPACE_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_base_uri,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","base-uri";), 
-        GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_BASE_URI_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_default_collation,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","default-collation";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_DEFAULT_COLLATION_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_statically_known_namespace_binding,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","statically-known-namespace-binding";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_in_scope_variables,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","in-scope-variables";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_VARIABLES_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_default_collection_type,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","default-collection-type";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_DEFAULT_COLLECTION_TYPE_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_xpath10_compatibility_mode,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","xpath10-compatibility-mode";), 
+        FunctionConsts::FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, fn_zorba_sctx_xpath10_compatibility_mode,
+        (createQName("http://zorba.io/modules/sctx","","xpath10-compatibility-mode";), 
         GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_XPATH10_COMPATIBILITY_MODE_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_statically_known_documents,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","statically-known-documents";), 
-        GENV_TYPESYSTEM.ANY_URI_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_DOCUMENTS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_statically_known_document_type,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","statically-known-document-type";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_DOCUMENT_TYPE_1);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_statically_known_collations,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","statically-known-collations";), 
-        GENV_TYPESYSTEM.ANY_URI_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_COLLATIONS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_construction_mode,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","construction-mode";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_CONSTRUCTION_MODE_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_ordering_mode,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","ordering-mode";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_ORDERING_MODE_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_default_order,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","default-order";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_DEFAULT_ORDER_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_boundary_space_policy,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","boundary-space-policy";), 
-        GENV_TYPESYSTEM.STRING_TYPE_ONE),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_BOUNDARY_SPACE_POLICY_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_copy_namespaces_mode,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","copy-namespaces-mode";), 
-        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_COPY_NAMESPACES_MODE_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_function_names,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","function-names";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_FUNCTION_NAMES_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_function_arguments_count,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","function-arguments-count";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
-        GENV_TYPESYSTEM.INT_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_FUNCTION_ARGUMENTS_COUNT_1);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_in_scope_schema_types,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","in-scope-schema-types";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_SCHEMA_TYPES_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_in_scope_element_declarations,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","in-scope-element-declarations";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ELEMENT_DECLARATIONS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_in_scope_attribute_declarations,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","in-scope-attribute-declarations";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ATTRIBUTE_DECLARATIONS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_in_scope_element_groups,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","in-scope-element-groups";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ELEMENT_GROUPS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_in_scope_attribute_groups,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","in-scope-attribute-groups";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ATTRIBUTE_GROUPS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_option,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","option";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_OPTION_1);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, fn_zorba_introspect_sctx_function_annotations,
-        (createQName("http://www.zorba-xquery.com/modules/introspection/sctx","","function-annotations";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
-        GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::FN_ZORBA_INTROSPECT_SCTX_FUNCTION_ANNOTATIONS_2);
+        FunctionConsts::FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0);
 
   }
 

=== modified file 'src/functions/pregenerated/func_sctx.h'
--- src/functions/pregenerated/func_sctx.h	2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_sctx.h	2013-10-01 03:26:58 +0000
@@ -38,371 +38,386 @@
 
 
 
-//fn-zorba-introspect-sctx:statically-known-namespaces
-class fn_zorba_introspect_sctx_statically_known_namespaces : public function
-{
-public:
-  fn_zorba_introspect_sctx_statically_known_namespaces(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:default-function-namespace
-class fn_zorba_introspect_sctx_default_function_namespace : public function
-{
-public:
-  fn_zorba_introspect_sctx_default_function_namespace(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:base-uri
-class fn_zorba_introspect_sctx_base_uri : public function
-{
-public:
-  fn_zorba_introspect_sctx_base_uri(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:default-collation
-class fn_zorba_introspect_sctx_default_collation : public function
-{
-public:
-  fn_zorba_introspect_sctx_default_collation(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:statically-known-namespace-binding
-class fn_zorba_introspect_sctx_statically_known_namespace_binding : public function
-{
-public:
-  fn_zorba_introspect_sctx_statically_known_namespace_binding(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:in-scope-variables
-class fn_zorba_introspect_sctx_in_scope_variables : public function
-{
-public:
-  fn_zorba_introspect_sctx_in_scope_variables(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:default-collection-type
-class fn_zorba_introspect_sctx_default_collection_type : public function
-{
-public:
-  fn_zorba_introspect_sctx_default_collection_type(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:xpath10-compatibility-mode
-class fn_zorba_introspect_sctx_xpath10_compatibility_mode : public function
-{
-public:
-  fn_zorba_introspect_sctx_xpath10_compatibility_mode(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:statically-known-documents
-class fn_zorba_introspect_sctx_statically_known_documents : public function
-{
-public:
-  fn_zorba_introspect_sctx_statically_known_documents(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:statically-known-document-type
-class fn_zorba_introspect_sctx_statically_known_document_type : public function
-{
-public:
-  fn_zorba_introspect_sctx_statically_known_document_type(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:statically-known-collations
-class fn_zorba_introspect_sctx_statically_known_collations : public function
-{
-public:
-  fn_zorba_introspect_sctx_statically_known_collations(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:construction-mode
-class fn_zorba_introspect_sctx_construction_mode : public function
-{
-public:
-  fn_zorba_introspect_sctx_construction_mode(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:ordering-mode
-class fn_zorba_introspect_sctx_ordering_mode : public function
-{
-public:
-  fn_zorba_introspect_sctx_ordering_mode(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:default-order
-class fn_zorba_introspect_sctx_default_order : public function
-{
-public:
-  fn_zorba_introspect_sctx_default_order(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:boundary-space-policy
-class fn_zorba_introspect_sctx_boundary_space_policy : public function
-{
-public:
-  fn_zorba_introspect_sctx_boundary_space_policy(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:copy-namespaces-mode
-class fn_zorba_introspect_sctx_copy_namespaces_mode : public function
-{
-public:
-  fn_zorba_introspect_sctx_copy_namespaces_mode(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:function-names
-class fn_zorba_introspect_sctx_function_names : public function
-{
-public:
-  fn_zorba_introspect_sctx_function_names(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:function-arguments-count
-class fn_zorba_introspect_sctx_function_arguments_count : public function
-{
-public:
-  fn_zorba_introspect_sctx_function_arguments_count(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:in-scope-schema-types
-class fn_zorba_introspect_sctx_in_scope_schema_types : public function
-{
-public:
-  fn_zorba_introspect_sctx_in_scope_schema_types(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:in-scope-element-declarations
-class fn_zorba_introspect_sctx_in_scope_element_declarations : public function
-{
-public:
-  fn_zorba_introspect_sctx_in_scope_element_declarations(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:in-scope-attribute-declarations
-class fn_zorba_introspect_sctx_in_scope_attribute_declarations : public function
-{
-public:
-  fn_zorba_introspect_sctx_in_scope_attribute_declarations(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:in-scope-element-groups
-class fn_zorba_introspect_sctx_in_scope_element_groups : public function
-{
-public:
-  fn_zorba_introspect_sctx_in_scope_element_groups(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:in-scope-attribute-groups
-class fn_zorba_introspect_sctx_in_scope_attribute_groups : public function
-{
-public:
-  fn_zorba_introspect_sctx_in_scope_attribute_groups(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:option
-class fn_zorba_introspect_sctx_option : public function
-{
-public:
-  fn_zorba_introspect_sctx_option(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  CODEGEN_DECL();
-};
-
-
-//fn-zorba-introspect-sctx:function-annotations
-class fn_zorba_introspect_sctx_function_annotations : public function
-{
-public:
-  fn_zorba_introspect_sctx_function_annotations(const signature& sig, FunctionConsts::FunctionKind kind)
+//fn-zorba-sctx:base-uri
+class fn_zorba_sctx_base_uri : public function
+{
+public:
+  fn_zorba_sctx_base_uri(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:boundary-space-policy
+class fn_zorba_sctx_boundary_space_policy : public function
+{
+public:
+  fn_zorba_sctx_boundary_space_policy(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:construction-mode
+class fn_zorba_sctx_construction_mode : public function
+{
+public:
+  fn_zorba_sctx_construction_mode(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:copy-namespaces-mode
+class fn_zorba_sctx_copy_namespaces_mode : public function
+{
+public:
+  fn_zorba_sctx_copy_namespaces_mode(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:default-collation
+class fn_zorba_sctx_default_collation : public function
+{
+public:
+  fn_zorba_sctx_default_collation(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:default-collection-type
+class fn_zorba_sctx_default_collection_type : public function
+{
+public:
+  fn_zorba_sctx_default_collection_type(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:default-function-namespace
+class fn_zorba_sctx_default_function_namespace : public function
+{
+public:
+  fn_zorba_sctx_default_function_namespace(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:default-order
+class fn_zorba_sctx_default_order : public function
+{
+public:
+  fn_zorba_sctx_default_order(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:function-annotations
+class fn_zorba_sctx_function_annotations : public function
+{
+public:
+  fn_zorba_sctx_function_annotations(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:function-arguments-count
+class fn_zorba_sctx_function_arguments_count : public function
+{
+public:
+  fn_zorba_sctx_function_arguments_count(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:function-names
+class fn_zorba_sctx_function_names : public function
+{
+public:
+  fn_zorba_sctx_function_names(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:functions
+class fn_zorba_sctx_functions : public function
+{
+public:
+  fn_zorba_sctx_functions(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:in-scope-attribute-declarations
+class fn_zorba_sctx_in_scope_attribute_declarations : public function
+{
+public:
+  fn_zorba_sctx_in_scope_attribute_declarations(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:in-scope-attribute-groups
+class fn_zorba_sctx_in_scope_attribute_groups : public function
+{
+public:
+  fn_zorba_sctx_in_scope_attribute_groups(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:in-scope-element-declarations
+class fn_zorba_sctx_in_scope_element_declarations : public function
+{
+public:
+  fn_zorba_sctx_in_scope_element_declarations(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:in-scope-element-groups
+class fn_zorba_sctx_in_scope_element_groups : public function
+{
+public:
+  fn_zorba_sctx_in_scope_element_groups(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:in-scope-schema-types
+class fn_zorba_sctx_in_scope_schema_types : public function
+{
+public:
+  fn_zorba_sctx_in_scope_schema_types(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:in-scope-variables
+class fn_zorba_sctx_in_scope_variables : public function
+{
+public:
+  fn_zorba_sctx_in_scope_variables(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:option
+class fn_zorba_sctx_option : public function
+{
+public:
+  fn_zorba_sctx_option(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:ordering-mode
+class fn_zorba_sctx_ordering_mode : public function
+{
+public:
+  fn_zorba_sctx_ordering_mode(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:statically-known-collations
+class fn_zorba_sctx_statically_known_collations : public function
+{
+public:
+  fn_zorba_sctx_statically_known_collations(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:statically-known-documents
+class fn_zorba_sctx_statically_known_documents : public function
+{
+public:
+  fn_zorba_sctx_statically_known_documents(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:statically-known-document-type
+class fn_zorba_sctx_statically_known_document_type : public function
+{
+public:
+  fn_zorba_sctx_statically_known_document_type(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:statically-known-namespace-binding
+class fn_zorba_sctx_statically_known_namespace_binding : public function
+{
+public:
+  fn_zorba_sctx_statically_known_namespace_binding(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:statically-known-namespaces
+class fn_zorba_sctx_statically_known_namespaces : public function
+{
+public:
+  fn_zorba_sctx_statically_known_namespaces(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-sctx:xpath10-compatibility-mode
+class fn_zorba_sctx_xpath10_compatibility_mode : public function
+{
+public:
+  fn_zorba_sctx_xpath10_compatibility_mode(const signature& sig, FunctionConsts::FunctionKind kind)
     : 
     function(sig, kind)
   {

=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h	2013-09-24 00:48:42 +0000
+++ src/functions/pregenerated/function_enum.h	2013-10-01 03:26:58 +0000
@@ -226,31 +226,6 @@
   ZORBA_STORE_INTEGRITY_CONSTRAINTS_STATIC_DDL_DEACTIVATE_1,
   ZORBA_STORE_INTEGRITY_CONSTRAINTS_STATIC_DML_CHECK_INTEGRITY_CONSTRAINT_1,
   ZORBA_STORE_INDEXES_STATIC_DML_KEYS_1,
-  FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_NAMESPACES_0,
-  FN_ZORBA_INTROSPECT_SCTX_DEFAULT_FUNCTION_NAMESPACE_0,
-  FN_ZORBA_INTROSPECT_SCTX_BASE_URI_0,
-  FN_ZORBA_INTROSPECT_SCTX_DEFAULT_COLLATION_0,
-  FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1,
-  FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_VARIABLES_0,
-  FN_ZORBA_INTROSPECT_SCTX_DEFAULT_COLLECTION_TYPE_0,
-  FN_ZORBA_INTROSPECT_SCTX_XPATH10_COMPATIBILITY_MODE_0,
-  FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_DOCUMENTS_0,
-  FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_DOCUMENT_TYPE_1,
-  FN_ZORBA_INTROSPECT_SCTX_STATICALLY_KNOWN_COLLATIONS_0,
-  FN_ZORBA_INTROSPECT_SCTX_CONSTRUCTION_MODE_0,
-  FN_ZORBA_INTROSPECT_SCTX_ORDERING_MODE_0,
-  FN_ZORBA_INTROSPECT_SCTX_DEFAULT_ORDER_0,
-  FN_ZORBA_INTROSPECT_SCTX_BOUNDARY_SPACE_POLICY_0,
-  FN_ZORBA_INTROSPECT_SCTX_COPY_NAMESPACES_MODE_0,
-  FN_ZORBA_INTROSPECT_SCTX_FUNCTION_NAMES_0,
-  FN_ZORBA_INTROSPECT_SCTX_FUNCTION_ARGUMENTS_COUNT_1,
-  FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_SCHEMA_TYPES_0,
-  FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ELEMENT_DECLARATIONS_0,
-  FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ATTRIBUTE_DECLARATIONS_0,
-  FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ELEMENT_GROUPS_0,
-  FN_ZORBA_INTROSPECT_SCTX_IN_SCOPE_ATTRIBUTE_GROUPS_0,
-  FN_ZORBA_INTROSPECT_SCTX_OPTION_1,
-  FN_ZORBA_INTROSPECT_SCTX_FUNCTION_ANNOTATIONS_2,
   FN_ZORBA_ITEM_SIZE_1,
   FN_ZORBA_JSON_JSON_TO_XML_INTERNAL_2,
   FN_ZORBA_JSON_XML_TO_JSON_INTERNAL_2,
@@ -393,6 +368,32 @@
   FN_ZORBA_SCHEMA_VALIDATE_IN_PLACE_1,
   FN_ZORBA_SCHEMA_SCHEMA_TYPE_1,
   FN_ZORBA_SCHEMA_IS_VALIDATED_1,
+  FN_ZORBA_SCTX_BASE_URI_0,
+  FN_ZORBA_SCTX_BOUNDARY_SPACE_POLICY_0,
+  FN_ZORBA_SCTX_CONSTRUCTION_MODE_0,
+  FN_ZORBA_SCTX_COPY_NAMESPACES_MODE_0,
+  FN_ZORBA_SCTX_DEFAULT_COLLATION_0,
+  FN_ZORBA_SCTX_DEFAULT_COLLECTION_TYPE_0,
+  FN_ZORBA_SCTX_DEFAULT_FUNCTION_NAMESPACE_0,
+  FN_ZORBA_SCTX_DEFAULT_ORDER_0,
+  FN_ZORBA_SCTX_FUNCTION_ANNOTATIONS_2,
+  FN_ZORBA_SCTX_FUNCTION_ARGUMENTS_COUNT_1,
+  FN_ZORBA_SCTX_FUNCTION_NAMES_0,
+  FN_ZORBA_SCTX_FUNCTIONS_0,
+  FN_ZORBA_SCTX_IN_SCOPE_ATTRIBUTE_DECLARATIONS_0,
+  FN_ZORBA_SCTX_IN_SCOPE_ATTRIBUTE_GROUPS_0,
+  FN_ZORBA_SCTX_IN_SCOPE_ELEMENT_DECLARATIONS_0,
+  FN_ZORBA_SCTX_IN_SCOPE_ELEMENT_GROUPS_0,
+  FN_ZORBA_SCTX_IN_SCOPE_SCHEMA_TYPES_0,
+  FN_ZORBA_SCTX_IN_SCOPE_VARIABLES_0,
+  FN_ZORBA_SCTX_OPTION_1,
+  FN_ZORBA_SCTX_ORDERING_MODE_0,
+  FN_ZORBA_SCTX_STATICALLY_KNOWN_COLLATIONS_0,
+  FN_ZORBA_SCTX_STATICALLY_KNOWN_DOCUMENTS_0,
+  FN_ZORBA_SCTX_STATICALLY_KNOWN_DOCUMENT_TYPE_1,
+  FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1,
+  FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0,
+  FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0,
   OP_CONCATENATE_N,
   FN_INDEX_OF_2,
   FN_INDEX_OF_3,

=== modified file 'src/runtime/CMakeLists.txt'
--- src/runtime/CMakeLists.txt	2013-08-21 23:52:57 +0000
+++ src/runtime/CMakeLists.txt	2013-10-01 03:26:58 +0000
@@ -179,3 +179,5 @@
 HEADER_GROUP_SUBFOLDER(RUNTIME_SRCS nodes)
 HEADER_GROUP_SUBFOLDER(RUNTIME_SRCS scripting)
 HEADER_GROUP_SUBFOLDER(RUNTIME_SRCS json)
+
+# vim:set et sw=2 ts=2:

=== modified file 'src/runtime/pregenerated/iterator_enum.h'
--- src/runtime/pregenerated/iterator_enum.h	2013-09-19 16:09:35 +0000
+++ src/runtime/pregenerated/iterator_enum.h	2013-10-01 03:26:58 +0000
@@ -138,31 +138,6 @@
   TYPE_DeactivateICIterator,
   TYPE_CheckICIterator,
   TYPE_IndexKeysIterator,
-  TYPE_StaticNamespacesIterator,
-  TYPE_DefaultFunctionNamespaceIterator,
-  TYPE_SctxBaseUriIterator,
-  TYPE_SctxDefaultCollationIterator,
-  TYPE_StaticNamespaceBindingIterator,
-  TYPE_InscopeVariablesIterator,
-  TYPE_DefaultCollectionTypeIterator,
-  TYPE_XPath10CompatModeIterator,
-  TYPE_StaticallyKnownDocumentsIterator,
-  TYPE_StaticallyKnownDocumentTypeIterator,
-  TYPE_StaticallyKnownCollationsIterator,
-  TYPE_ConstructionModeIterator,
-  TYPE_OrderingModeIterator,
-  TYPE_DefaultOrderIterator,
-  TYPE_BoundarySpacePolicyIterator,
-  TYPE_CopyNamespacesModeIterator,
-  TYPE_FunctionNamesIterator,
-  TYPE_FunctionArgumentsCountIterator,
-  TYPE_InScopeSchemaTypesIterator,
-  TYPE_InScopeElementDeclarationsIterator,
-  TYPE_InScopeAttributeDeclarationsIterator,
-  TYPE_InScopeElementGroupsIterator,
-  TYPE_InScopeAttributeGroupsIterator,
-  TYPE_OptionIterator,
-  TYPE_FunctionAnnotationsIterator,
   TYPE_MemSizeIterator,
   TYPE_JSONtoXMLInternal,
   TYPE_XMLtoJSONInternal,
@@ -289,6 +264,32 @@
   TYPE_ZorbaValidateInPlaceIterator,
   TYPE_ZorbaSchemaTypeIterator,
   TYPE_ZorbaIsValidatedIterator,
+  TYPE_SctxBaseUriIterator,
+  TYPE_SctxBoundarySpacePolicyIterator,
+  TYPE_SctxConstructionModeIterator,
+  TYPE_SctxCopyNamespacesModeIterator,
+  TYPE_SctxDefaultCollationIterator,
+  TYPE_SctxDefaultCollectionTypeIterator,
+  TYPE_SctxDefaultFunctionNamespaceIterator,
+  TYPE_SctxDefaultOrderIterator,
+  TYPE_SctxFunctionAnnotationsIterator,
+  TYPE_SctxFunctionArgumentsCountIterator,
+  TYPE_SctxFunctionNamesIterator,
+  TYPE_SctxFunctionsIterator,
+  TYPE_SctxInScopeAttributeDeclarationsIterator,
+  TYPE_SctxInScopeAttributeGroupsIterator,
+  TYPE_SctxInScopeElementDeclarationsIterator,
+  TYPE_SctxInScopeElementGroupsIterator,
+  TYPE_SctxInScopeSchemaTypesIterator,
+  TYPE_SctxInscopeVariablesIterator,
+  TYPE_SctxOptionIterator,
+  TYPE_SctxOrderingModeIterator,
+  TYPE_SctxStaticallyKnownCollationsIterator,
+  TYPE_SctxStaticallyKnownDocumentsIterator,
+  TYPE_SctxStaticallyKnownDocumentTypeIterator,
+  TYPE_SctxStaticallyKnownNamespaceBindingIterator,
+  TYPE_SctxStaticallyKnownNamespacesIterator,
+  TYPE_SctxXPath10CompatModeIterator,
   TYPE_FnConcatIterator,
   TYPE_FnIndexOfIterator,
   TYPE_FnEmptyIterator,

=== added directory 'src/runtime/sctx'
=== added directory 'src/runtime/sctx/pregenerated'
=== renamed file 'src/runtime/introspection/pregenerated/sctx.cpp' => 'src/runtime/sctx/pregenerated/sctx.cpp'
--- src/runtime/introspection/pregenerated/sctx.cpp	2013-03-05 23:11:50 +0000
+++ src/runtime/sctx/pregenerated/sctx.cpp	2013-10-01 03:26:58 +0000
@@ -25,7 +25,7 @@
 #include "zorbatypes/rchandle.h"
 #include "zorbatypes/zstring.h"
 #include "runtime/visitors/planiter_visitor.h"
-#include "runtime/introspection/sctx.h"
+#include "runtime/sctx/sctx.h"
 #include "system/globalenv.h"
 
 
@@ -33,68 +33,6 @@
 
 namespace zorba {
 
-// <StaticNamespacesIterator>
-SERIALIZABLE_CLASS_VERSIONS(StaticNamespacesIterator)
-
-void StaticNamespacesIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<StaticNamespacesIterator, StaticNamespacesIteratorState>*)this);
-}
-
-
-void StaticNamespacesIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-StaticNamespacesIterator::~StaticNamespacesIterator() {}
-
-StaticNamespacesIteratorState::StaticNamespacesIteratorState() {}
-
-
-void StaticNamespacesIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </StaticNamespacesIterator>
-
-
-// <DefaultFunctionNamespaceIterator>
-SERIALIZABLE_CLASS_VERSIONS(DefaultFunctionNamespaceIterator)
-
-void DefaultFunctionNamespaceIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<DefaultFunctionNamespaceIterator, PlanIteratorState>*)this);
-}
-
-
-void DefaultFunctionNamespaceIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-DefaultFunctionNamespaceIterator::~DefaultFunctionNamespaceIterator() {}
-
-// </DefaultFunctionNamespaceIterator>
-
-
 // <SctxBaseUriIterator>
 SERIALIZABLE_CLASS_VERSIONS(SctxBaseUriIterator)
 
@@ -123,6 +61,90 @@
 // </SctxBaseUriIterator>
 
 
+// <SctxBoundarySpacePolicyIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxBoundarySpacePolicyIterator)
+
+void SctxBoundarySpacePolicyIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxBoundarySpacePolicyIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxBoundarySpacePolicyIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxBoundarySpacePolicyIterator::~SctxBoundarySpacePolicyIterator() {}
+
+// </SctxBoundarySpacePolicyIterator>
+
+
+// <SctxConstructionModeIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxConstructionModeIterator)
+
+void SctxConstructionModeIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxConstructionModeIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxConstructionModeIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxConstructionModeIterator::~SctxConstructionModeIterator() {}
+
+// </SctxConstructionModeIterator>
+
+
+// <SctxCopyNamespacesModeIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxCopyNamespacesModeIterator)
+
+void SctxCopyNamespacesModeIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxCopyNamespacesModeIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxCopyNamespacesModeIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxCopyNamespacesModeIterator::~SctxCopyNamespacesModeIterator() {}
+
+// </SctxCopyNamespacesModeIterator>
+
+
 // <SctxDefaultCollationIterator>
 SERIALIZABLE_CLASS_VERSIONS(SctxDefaultCollationIterator)
 
@@ -151,658 +173,696 @@
 // </SctxDefaultCollationIterator>
 
 
-// <StaticNamespaceBindingIterator>
-SERIALIZABLE_CLASS_VERSIONS(StaticNamespaceBindingIterator)
-
-void StaticNamespaceBindingIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<StaticNamespaceBindingIterator, PlanIteratorState>*)this);
-}
-
-
-void StaticNamespaceBindingIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-StaticNamespaceBindingIterator::~StaticNamespaceBindingIterator() {}
-
-// </StaticNamespaceBindingIterator>
-
-
-// <InscopeVariablesIterator>
-SERIALIZABLE_CLASS_VERSIONS(InscopeVariablesIterator)
-
-void InscopeVariablesIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<InscopeVariablesIterator, InscopeVariablesIteratorState>*)this);
-}
-
-
-void InscopeVariablesIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-InscopeVariablesIterator::~InscopeVariablesIterator() {}
-
-InscopeVariablesIteratorState::InscopeVariablesIteratorState() {}
-
-
-void InscopeVariablesIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </InscopeVariablesIterator>
-
-
-// <DefaultCollectionTypeIterator>
-SERIALIZABLE_CLASS_VERSIONS(DefaultCollectionTypeIterator)
-
-void DefaultCollectionTypeIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<DefaultCollectionTypeIterator, PlanIteratorState>*)this);
-}
-
-
-void DefaultCollectionTypeIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-DefaultCollectionTypeIterator::~DefaultCollectionTypeIterator() {}
-
-// </DefaultCollectionTypeIterator>
-
-
-// <XPath10CompatModeIterator>
-SERIALIZABLE_CLASS_VERSIONS(XPath10CompatModeIterator)
-
-void XPath10CompatModeIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<XPath10CompatModeIterator, PlanIteratorState>*)this);
-}
-
-
-void XPath10CompatModeIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-XPath10CompatModeIterator::~XPath10CompatModeIterator() {}
-
-// </XPath10CompatModeIterator>
-
-
-// <StaticallyKnownDocumentsIterator>
-SERIALIZABLE_CLASS_VERSIONS(StaticallyKnownDocumentsIterator)
-
-void StaticallyKnownDocumentsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<StaticallyKnownDocumentsIterator, StaticallyKnownDocumentsIteratorState>*)this);
-}
-
-
-void StaticallyKnownDocumentsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-StaticallyKnownDocumentsIterator::~StaticallyKnownDocumentsIterator() {}
-
-StaticallyKnownDocumentsIteratorState::StaticallyKnownDocumentsIteratorState() {}
-
-
-void StaticallyKnownDocumentsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </StaticallyKnownDocumentsIterator>
-
-
-// <StaticallyKnownDocumentTypeIterator>
-SERIALIZABLE_CLASS_VERSIONS(StaticallyKnownDocumentTypeIterator)
-
-void StaticallyKnownDocumentTypeIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<StaticallyKnownDocumentTypeIterator, PlanIteratorState>*)this);
-}
-
-
-void StaticallyKnownDocumentTypeIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-StaticallyKnownDocumentTypeIterator::~StaticallyKnownDocumentTypeIterator() {}
-
-// </StaticallyKnownDocumentTypeIterator>
-
-
-// <StaticallyKnownCollationsIterator>
-SERIALIZABLE_CLASS_VERSIONS(StaticallyKnownCollationsIterator)
-
-void StaticallyKnownCollationsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<StaticallyKnownCollationsIterator, StaticallyKnownCollationsIteratorState>*)this);
-}
-
-
-void StaticallyKnownCollationsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-StaticallyKnownCollationsIterator::~StaticallyKnownCollationsIterator() {}
-
-StaticallyKnownCollationsIteratorState::StaticallyKnownCollationsIteratorState() {}
-
-
-void StaticallyKnownCollationsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </StaticallyKnownCollationsIterator>
-
-
-// <ConstructionModeIterator>
-SERIALIZABLE_CLASS_VERSIONS(ConstructionModeIterator)
-
-void ConstructionModeIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<ConstructionModeIterator, PlanIteratorState>*)this);
-}
-
-
-void ConstructionModeIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-ConstructionModeIterator::~ConstructionModeIterator() {}
-
-// </ConstructionModeIterator>
-
-
-// <OrderingModeIterator>
-SERIALIZABLE_CLASS_VERSIONS(OrderingModeIterator)
-
-void OrderingModeIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<OrderingModeIterator, PlanIteratorState>*)this);
-}
-
-
-void OrderingModeIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-OrderingModeIterator::~OrderingModeIterator() {}
-
-// </OrderingModeIterator>
-
-
-// <DefaultOrderIterator>
-SERIALIZABLE_CLASS_VERSIONS(DefaultOrderIterator)
-
-void DefaultOrderIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<DefaultOrderIterator, PlanIteratorState>*)this);
-}
-
-
-void DefaultOrderIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-DefaultOrderIterator::~DefaultOrderIterator() {}
-
-// </DefaultOrderIterator>
-
-
-// <BoundarySpacePolicyIterator>
-SERIALIZABLE_CLASS_VERSIONS(BoundarySpacePolicyIterator)
-
-void BoundarySpacePolicyIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<BoundarySpacePolicyIterator, PlanIteratorState>*)this);
-}
-
-
-void BoundarySpacePolicyIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-BoundarySpacePolicyIterator::~BoundarySpacePolicyIterator() {}
-
-// </BoundarySpacePolicyIterator>
-
-
-// <CopyNamespacesModeIterator>
-SERIALIZABLE_CLASS_VERSIONS(CopyNamespacesModeIterator)
-
-void CopyNamespacesModeIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<CopyNamespacesModeIterator, PlanIteratorState>*)this);
-}
-
-
-void CopyNamespacesModeIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-CopyNamespacesModeIterator::~CopyNamespacesModeIterator() {}
-
-// </CopyNamespacesModeIterator>
-
-
-// <FunctionNamesIterator>
-SERIALIZABLE_CLASS_VERSIONS(FunctionNamesIterator)
-
-void FunctionNamesIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<FunctionNamesIterator, FunctionNamesIteratorState>*)this);
-}
-
-
-void FunctionNamesIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-FunctionNamesIterator::~FunctionNamesIterator() {}
-
-FunctionNamesIteratorState::FunctionNamesIteratorState() {}
-
-
-void FunctionNamesIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </FunctionNamesIterator>
-
-
-// <FunctionArgumentsCountIterator>
-SERIALIZABLE_CLASS_VERSIONS(FunctionArgumentsCountIterator)
-
-void FunctionArgumentsCountIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<FunctionArgumentsCountIterator, FunctionArgumentsCountIteratorState>*)this);
-}
-
-
-void FunctionArgumentsCountIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-FunctionArgumentsCountIterator::~FunctionArgumentsCountIterator() {}
-
-FunctionArgumentsCountIteratorState::FunctionArgumentsCountIteratorState() {}
-
-
-void FunctionArgumentsCountIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </FunctionArgumentsCountIterator>
-
-
-// <InScopeSchemaTypesIterator>
-SERIALIZABLE_CLASS_VERSIONS(InScopeSchemaTypesIterator)
-
-void InScopeSchemaTypesIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<InScopeSchemaTypesIterator, InScopeSchemaTypesIteratorState>*)this);
-}
-
-
-void InScopeSchemaTypesIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-InScopeSchemaTypesIterator::~InScopeSchemaTypesIterator() {}
-
-InScopeSchemaTypesIteratorState::InScopeSchemaTypesIteratorState() {}
-
-
-void InScopeSchemaTypesIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </InScopeSchemaTypesIterator>
-
-
-// <InScopeElementDeclarationsIterator>
-SERIALIZABLE_CLASS_VERSIONS(InScopeElementDeclarationsIterator)
-
-void InScopeElementDeclarationsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<InScopeElementDeclarationsIterator, InScopeElementDeclarationsIteratorState>*)this);
-}
-
-
-void InScopeElementDeclarationsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-InScopeElementDeclarationsIterator::~InScopeElementDeclarationsIterator() {}
-
-InScopeElementDeclarationsIteratorState::InScopeElementDeclarationsIteratorState() {}
-
-
-void InScopeElementDeclarationsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </InScopeElementDeclarationsIterator>
-
-
-// <InScopeAttributeDeclarationsIterator>
-SERIALIZABLE_CLASS_VERSIONS(InScopeAttributeDeclarationsIterator)
-
-void InScopeAttributeDeclarationsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<InScopeAttributeDeclarationsIterator, InScopeAttributeDeclarationsIteratorState>*)this);
-}
-
-
-void InScopeAttributeDeclarationsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-InScopeAttributeDeclarationsIterator::~InScopeAttributeDeclarationsIterator() {}
-
-InScopeAttributeDeclarationsIteratorState::InScopeAttributeDeclarationsIteratorState() {}
-
-
-void InScopeAttributeDeclarationsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </InScopeAttributeDeclarationsIterator>
-
-
-// <InScopeElementGroupsIterator>
-SERIALIZABLE_CLASS_VERSIONS(InScopeElementGroupsIterator)
-
-void InScopeElementGroupsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<InScopeElementGroupsIterator, InScopeElementGroupsIteratorState>*)this);
-}
-
-
-void InScopeElementGroupsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-InScopeElementGroupsIterator::~InScopeElementGroupsIterator() {}
-
-InScopeElementGroupsIteratorState::InScopeElementGroupsIteratorState() {}
-
-
-void InScopeElementGroupsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </InScopeElementGroupsIterator>
-
-
-// <InScopeAttributeGroupsIterator>
-SERIALIZABLE_CLASS_VERSIONS(InScopeAttributeGroupsIterator)
-
-void InScopeAttributeGroupsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<InScopeAttributeGroupsIterator, InScopeAttributeGroupsIteratorState>*)this);
-}
-
-
-void InScopeAttributeGroupsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-InScopeAttributeGroupsIterator::~InScopeAttributeGroupsIterator() {}
-
-InScopeAttributeGroupsIteratorState::InScopeAttributeGroupsIteratorState() {}
-
-
-void InScopeAttributeGroupsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </InScopeAttributeGroupsIterator>
-
-
-// <OptionIterator>
-SERIALIZABLE_CLASS_VERSIONS(OptionIterator)
-
-void OptionIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<OptionIterator, PlanIteratorState>*)this);
-}
-
-
-void OptionIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-OptionIterator::~OptionIterator() {}
-
-// </OptionIterator>
-
-
-// <FunctionAnnotationsIterator>
-SERIALIZABLE_CLASS_VERSIONS(FunctionAnnotationsIterator)
-
-void FunctionAnnotationsIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<FunctionAnnotationsIterator, FunctionAnnotationsIteratorState>*)this);
-}
-
-
-void FunctionAnnotationsIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-FunctionAnnotationsIterator::~FunctionAnnotationsIterator() {}
-
-FunctionAnnotationsIteratorState::FunctionAnnotationsIteratorState() {}
-
-
-void FunctionAnnotationsIteratorState::init(PlanState& planState) {
-  PlanIteratorState::init(planState);
-}
-// </FunctionAnnotationsIterator>
+// <SctxDefaultCollectionTypeIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxDefaultCollectionTypeIterator)
+
+void SctxDefaultCollectionTypeIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxDefaultCollectionTypeIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxDefaultCollectionTypeIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxDefaultCollectionTypeIterator::~SctxDefaultCollectionTypeIterator() {}
+
+// </SctxDefaultCollectionTypeIterator>
+
+
+// <SctxDefaultFunctionNamespaceIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxDefaultFunctionNamespaceIterator)
+
+void SctxDefaultFunctionNamespaceIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxDefaultFunctionNamespaceIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxDefaultFunctionNamespaceIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxDefaultFunctionNamespaceIterator::~SctxDefaultFunctionNamespaceIterator() {}
+
+// </SctxDefaultFunctionNamespaceIterator>
+
+
+// <SctxDefaultOrderIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxDefaultOrderIterator)
+
+void SctxDefaultOrderIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxDefaultOrderIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxDefaultOrderIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxDefaultOrderIterator::~SctxDefaultOrderIterator() {}
+
+// </SctxDefaultOrderIterator>
+
+
+// <SctxFunctionAnnotationsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxFunctionAnnotationsIterator)
+
+void SctxFunctionAnnotationsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxFunctionAnnotationsIterator, SctxFunctionAnnotationsIteratorState>*)this);
+}
+
+
+void SctxFunctionAnnotationsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxFunctionAnnotationsIterator::~SctxFunctionAnnotationsIterator() {}
+
+SctxFunctionAnnotationsIteratorState::SctxFunctionAnnotationsIteratorState() {}
+
+SctxFunctionAnnotationsIteratorState::~SctxFunctionAnnotationsIteratorState() {}
+
+
+void SctxFunctionAnnotationsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxFunctionAnnotationsIterator>
+
+
+// <SctxFunctionArgumentsCountIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxFunctionArgumentsCountIterator)
+
+void SctxFunctionArgumentsCountIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxFunctionArgumentsCountIterator, SctxFunctionArgumentsCountIteratorState>*)this);
+}
+
+
+void SctxFunctionArgumentsCountIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxFunctionArgumentsCountIterator::~SctxFunctionArgumentsCountIterator() {}
+
+SctxFunctionArgumentsCountIteratorState::SctxFunctionArgumentsCountIteratorState() {}
+
+SctxFunctionArgumentsCountIteratorState::~SctxFunctionArgumentsCountIteratorState() {}
+
+
+void SctxFunctionArgumentsCountIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxFunctionArgumentsCountIterator>
+
+
+// <SctxFunctionNamesIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxFunctionNamesIterator)
+
+void SctxFunctionNamesIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxFunctionNamesIterator, SctxFunctionNamesIteratorState>*)this);
+}
+
+
+void SctxFunctionNamesIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxFunctionNamesIterator::~SctxFunctionNamesIterator() {}
+
+SctxFunctionNamesIteratorState::SctxFunctionNamesIteratorState() {}
+
+SctxFunctionNamesIteratorState::~SctxFunctionNamesIteratorState() {}
+
+
+void SctxFunctionNamesIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxFunctionNamesIterator>
+
+
+// <SctxFunctionsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxFunctionsIterator)
+
+void SctxFunctionsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxFunctionsIterator, SctxFunctionsIteratorState>*)this);
+}
+
+
+void SctxFunctionsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxFunctionsIterator::~SctxFunctionsIterator() {}
+
+SctxFunctionsIteratorState::SctxFunctionsIteratorState() {}
+
+SctxFunctionsIteratorState::~SctxFunctionsIteratorState() {}
+
+
+void SctxFunctionsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxFunctionsIterator>
+
+
+// <SctxInScopeAttributeDeclarationsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxInScopeAttributeDeclarationsIterator)
+
+void SctxInScopeAttributeDeclarationsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxInScopeAttributeDeclarationsIterator, SctxInScopeAttributeDeclarationsIteratorState>*)this);
+}
+
+
+void SctxInScopeAttributeDeclarationsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxInScopeAttributeDeclarationsIterator::~SctxInScopeAttributeDeclarationsIterator() {}
+
+SctxInScopeAttributeDeclarationsIteratorState::SctxInScopeAttributeDeclarationsIteratorState() {}
+
+SctxInScopeAttributeDeclarationsIteratorState::~SctxInScopeAttributeDeclarationsIteratorState() {}
+
+
+void SctxInScopeAttributeDeclarationsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxInScopeAttributeDeclarationsIterator>
+
+
+// <SctxInScopeAttributeGroupsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxInScopeAttributeGroupsIterator)
+
+void SctxInScopeAttributeGroupsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxInScopeAttributeGroupsIterator, SctxInScopeAttributeGroupsIteratorState>*)this);
+}
+
+
+void SctxInScopeAttributeGroupsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxInScopeAttributeGroupsIterator::~SctxInScopeAttributeGroupsIterator() {}
+
+SctxInScopeAttributeGroupsIteratorState::SctxInScopeAttributeGroupsIteratorState() {}
+
+SctxInScopeAttributeGroupsIteratorState::~SctxInScopeAttributeGroupsIteratorState() {}
+
+
+void SctxInScopeAttributeGroupsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxInScopeAttributeGroupsIterator>
+
+
+// <SctxInScopeElementDeclarationsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxInScopeElementDeclarationsIterator)
+
+void SctxInScopeElementDeclarationsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxInScopeElementDeclarationsIterator, SctxInScopeElementDeclarationsIteratorState>*)this);
+}
+
+
+void SctxInScopeElementDeclarationsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxInScopeElementDeclarationsIterator::~SctxInScopeElementDeclarationsIterator() {}
+
+SctxInScopeElementDeclarationsIteratorState::SctxInScopeElementDeclarationsIteratorState() {}
+
+SctxInScopeElementDeclarationsIteratorState::~SctxInScopeElementDeclarationsIteratorState() {}
+
+
+void SctxInScopeElementDeclarationsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxInScopeElementDeclarationsIterator>
+
+
+// <SctxInScopeElementGroupsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxInScopeElementGroupsIterator)
+
+void SctxInScopeElementGroupsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxInScopeElementGroupsIterator, SctxInScopeElementGroupsIteratorState>*)this);
+}
+
+
+void SctxInScopeElementGroupsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxInScopeElementGroupsIterator::~SctxInScopeElementGroupsIterator() {}
+
+SctxInScopeElementGroupsIteratorState::SctxInScopeElementGroupsIteratorState() {}
+
+SctxInScopeElementGroupsIteratorState::~SctxInScopeElementGroupsIteratorState() {}
+
+
+void SctxInScopeElementGroupsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxInScopeElementGroupsIterator>
+
+
+// <SctxInScopeSchemaTypesIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxInScopeSchemaTypesIterator)
+
+void SctxInScopeSchemaTypesIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxInScopeSchemaTypesIterator, SctxInScopeSchemaTypesIteratorState>*)this);
+}
+
+
+void SctxInScopeSchemaTypesIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxInScopeSchemaTypesIterator::~SctxInScopeSchemaTypesIterator() {}
+
+SctxInScopeSchemaTypesIteratorState::SctxInScopeSchemaTypesIteratorState() {}
+
+SctxInScopeSchemaTypesIteratorState::~SctxInScopeSchemaTypesIteratorState() {}
+
+
+void SctxInScopeSchemaTypesIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxInScopeSchemaTypesIterator>
+
+
+// <SctxInscopeVariablesIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxInscopeVariablesIterator)
+
+void SctxInscopeVariablesIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxInscopeVariablesIterator, SctxInscopeVariablesIteratorState>*)this);
+}
+
+
+void SctxInscopeVariablesIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxInscopeVariablesIterator::~SctxInscopeVariablesIterator() {}
+
+SctxInscopeVariablesIteratorState::SctxInscopeVariablesIteratorState() {}
+
+SctxInscopeVariablesIteratorState::~SctxInscopeVariablesIteratorState() {}
+
+
+void SctxInscopeVariablesIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxInscopeVariablesIterator>
+
+
+// <SctxOptionIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxOptionIterator)
+
+void SctxOptionIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxOptionIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxOptionIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxOptionIterator::~SctxOptionIterator() {}
+
+// </SctxOptionIterator>
+
+
+// <SctxOrderingModeIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxOrderingModeIterator)
+
+void SctxOrderingModeIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxOrderingModeIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxOrderingModeIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxOrderingModeIterator::~SctxOrderingModeIterator() {}
+
+// </SctxOrderingModeIterator>
+
+
+// <SctxStaticallyKnownCollationsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxStaticallyKnownCollationsIterator)
+
+void SctxStaticallyKnownCollationsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxStaticallyKnownCollationsIterator, SctxStaticallyKnownCollationsIteratorState>*)this);
+}
+
+
+void SctxStaticallyKnownCollationsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxStaticallyKnownCollationsIterator::~SctxStaticallyKnownCollationsIterator() {}
+
+SctxStaticallyKnownCollationsIteratorState::SctxStaticallyKnownCollationsIteratorState() {}
+
+SctxStaticallyKnownCollationsIteratorState::~SctxStaticallyKnownCollationsIteratorState() {}
+
+
+void SctxStaticallyKnownCollationsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxStaticallyKnownCollationsIterator>
+
+
+// <SctxStaticallyKnownDocumentsIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxStaticallyKnownDocumentsIterator)
+
+void SctxStaticallyKnownDocumentsIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxStaticallyKnownDocumentsIterator, SctxStaticallyKnownDocumentsIteratorState>*)this);
+}
+
+
+void SctxStaticallyKnownDocumentsIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxStaticallyKnownDocumentsIterator::~SctxStaticallyKnownDocumentsIterator() {}
+
+SctxStaticallyKnownDocumentsIteratorState::SctxStaticallyKnownDocumentsIteratorState() {}
+
+SctxStaticallyKnownDocumentsIteratorState::~SctxStaticallyKnownDocumentsIteratorState() {}
+
+
+void SctxStaticallyKnownDocumentsIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxStaticallyKnownDocumentsIterator>
+
+
+// <SctxStaticallyKnownDocumentTypeIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxStaticallyKnownDocumentTypeIterator)
+
+void SctxStaticallyKnownDocumentTypeIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxStaticallyKnownDocumentTypeIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxStaticallyKnownDocumentTypeIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxStaticallyKnownDocumentTypeIterator::~SctxStaticallyKnownDocumentTypeIterator() {}
+
+// </SctxStaticallyKnownDocumentTypeIterator>
+
+
+// <SctxStaticallyKnownNamespaceBindingIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxStaticallyKnownNamespaceBindingIterator)
+
+void SctxStaticallyKnownNamespaceBindingIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxStaticallyKnownNamespaceBindingIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxStaticallyKnownNamespaceBindingIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxStaticallyKnownNamespaceBindingIterator::~SctxStaticallyKnownNamespaceBindingIterator() {}
+
+// </SctxStaticallyKnownNamespaceBindingIterator>
+
+
+// <SctxStaticallyKnownNamespacesIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxStaticallyKnownNamespacesIterator)
+
+void SctxStaticallyKnownNamespacesIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxStaticallyKnownNamespacesIterator, SctxStaticallyKnownNamespacesIteratorState>*)this);
+}
+
+
+void SctxStaticallyKnownNamespacesIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxStaticallyKnownNamespacesIterator::~SctxStaticallyKnownNamespacesIterator() {}
+
+SctxStaticallyKnownNamespacesIteratorState::SctxStaticallyKnownNamespacesIteratorState() {}
+
+SctxStaticallyKnownNamespacesIteratorState::~SctxStaticallyKnownNamespacesIteratorState() {}
+
+
+void SctxStaticallyKnownNamespacesIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+// </SctxStaticallyKnownNamespacesIterator>
+
+
+// <SctxXPath10CompatModeIterator>
+SERIALIZABLE_CLASS_VERSIONS(SctxXPath10CompatModeIterator)
+
+void SctxXPath10CompatModeIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<SctxXPath10CompatModeIterator, PlanIteratorState>*)this);
+}
+
+
+void SctxXPath10CompatModeIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+SctxXPath10CompatModeIterator::~SctxXPath10CompatModeIterator() {}
+
+// </SctxXPath10CompatModeIterator>
 
 
 

=== renamed file 'src/runtime/introspection/pregenerated/sctx.h' => 'src/runtime/sctx/pregenerated/sctx.h'
--- src/runtime/introspection/pregenerated/sctx.h	2013-03-05 23:11:50 +0000
+++ src/runtime/sctx/pregenerated/sctx.h	2013-10-01 03:26:58 +0000
@@ -20,8 +20,8 @@
 // * SEE .xml FILE WITH SAME NAME           *
 // *                                        *
 // ******************************************
-#ifndef ZORBA_RUNTIME_INTROSPECTION_SCTX_H
-#define ZORBA_RUNTIME_INTROSPECTION_SCTX_H
+#ifndef ZORBA_RUNTIME_SCTX_SCTX_H
+#define ZORBA_RUNTIME_SCTX_SCTX_H
 
 
 #include "common/shared_types.h"
@@ -36,87 +36,7 @@
 
 /**
  * 
- *      sc:statically-known-namespaces
- *    
- * Author: Zorba Team
- */
-class StaticNamespacesIteratorState : public PlanIteratorState
-{
-public:
-  store::NsBindings theBindings; //vector of namespace bindings
-  ulong thePosition; //current position
-
-  StaticNamespacesIteratorState();
-
-  ~StaticNamespacesIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class StaticNamespacesIterator : public NaryBaseIterator<StaticNamespacesIterator, StaticNamespacesIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(StaticNamespacesIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(StaticNamespacesIterator,
-    NaryBaseIterator<StaticNamespacesIterator, StaticNamespacesIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  StaticNamespacesIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<StaticNamespacesIterator, StaticNamespacesIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~StaticNamespacesIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *      sc:default-function-namespace
- *    
- * Author: Zorba Team
- */
-class DefaultFunctionNamespaceIterator : public NaryBaseIterator<DefaultFunctionNamespaceIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(DefaultFunctionNamespaceIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(DefaultFunctionNamespaceIterator,
-    NaryBaseIterator<DefaultFunctionNamespaceIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  DefaultFunctionNamespaceIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<DefaultFunctionNamespaceIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~DefaultFunctionNamespaceIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *      sc:base-uri
- *    
- * Author: Zorba Team
+ * Author: 
  */
 class SctxBaseUriIterator : public NaryBaseIterator<SctxBaseUriIterator, PlanIteratorState>
 { 
@@ -146,9 +66,97 @@
 
 /**
  * 
- *      sc:default-collation
- *    
- * Author: Zorba Team
+ * Author: 
+ */
+class SctxBoundarySpacePolicyIterator : public NaryBaseIterator<SctxBoundarySpacePolicyIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxBoundarySpacePolicyIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxBoundarySpacePolicyIterator,
+    NaryBaseIterator<SctxBoundarySpacePolicyIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxBoundarySpacePolicyIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxBoundarySpacePolicyIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxBoundarySpacePolicyIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxConstructionModeIterator : public NaryBaseIterator<SctxConstructionModeIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxConstructionModeIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxConstructionModeIterator,
+    NaryBaseIterator<SctxConstructionModeIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxConstructionModeIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxConstructionModeIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxConstructionModeIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxCopyNamespacesModeIterator : public NaryBaseIterator<SctxCopyNamespacesModeIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxCopyNamespacesModeIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxCopyNamespacesModeIterator,
+    NaryBaseIterator<SctxCopyNamespacesModeIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxCopyNamespacesModeIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxCopyNamespacesModeIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxCopyNamespacesModeIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
  */
 class SctxDefaultCollationIterator : public NaryBaseIterator<SctxDefaultCollationIterator, PlanIteratorState>
 { 
@@ -178,823 +186,810 @@
 
 /**
  * 
- *      sc:statically-known-namespace-binding
- *    
- * Author: Zorba Team
- */
-class StaticNamespaceBindingIterator : public NaryBaseIterator<StaticNamespaceBindingIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(StaticNamespaceBindingIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(StaticNamespaceBindingIterator,
-    NaryBaseIterator<StaticNamespaceBindingIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  StaticNamespaceBindingIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<StaticNamespaceBindingIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~StaticNamespaceBindingIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:in-scope-variables
- *  
- * Author: Zorba Team
- */
-class InscopeVariablesIteratorState : public PlanIteratorState
-{
-public:
-  std::vector<VarInfo*> theVariables; //vector of variables
-  csize thePosition; //current position
-
-  InscopeVariablesIteratorState();
-
-  ~InscopeVariablesIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class InscopeVariablesIterator : public NaryBaseIterator<InscopeVariablesIterator, InscopeVariablesIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(InscopeVariablesIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InscopeVariablesIterator,
-    NaryBaseIterator<InscopeVariablesIterator, InscopeVariablesIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  InscopeVariablesIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<InscopeVariablesIterator, InscopeVariablesIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~InscopeVariablesIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:default-collection-type
- *  
- * Author: Zorba Team
- */
-class DefaultCollectionTypeIterator : public NaryBaseIterator<DefaultCollectionTypeIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(DefaultCollectionTypeIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(DefaultCollectionTypeIterator,
-    NaryBaseIterator<DefaultCollectionTypeIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  DefaultCollectionTypeIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<DefaultCollectionTypeIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~DefaultCollectionTypeIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:xpath10-compatibility-mode
- *  
- * Author: Zorba Team
- */
-class XPath10CompatModeIterator : public NaryBaseIterator<XPath10CompatModeIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(XPath10CompatModeIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(XPath10CompatModeIterator,
-    NaryBaseIterator<XPath10CompatModeIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  XPath10CompatModeIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<XPath10CompatModeIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~XPath10CompatModeIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:statically-known-documents
- *  
- * Author: Zorba Team
- */
-class StaticallyKnownDocumentsIteratorState : public PlanIteratorState
-{
-public:
-  std::vector < zstring > theDocuments; //vector of document URIs
-  ulong thePosition; //current position
-
-  StaticallyKnownDocumentsIteratorState();
-
-  ~StaticallyKnownDocumentsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class StaticallyKnownDocumentsIterator : public NaryBaseIterator<StaticallyKnownDocumentsIterator, StaticallyKnownDocumentsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(StaticallyKnownDocumentsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(StaticallyKnownDocumentsIterator,
-    NaryBaseIterator<StaticallyKnownDocumentsIterator, StaticallyKnownDocumentsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  StaticallyKnownDocumentsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<StaticallyKnownDocumentsIterator, StaticallyKnownDocumentsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~StaticallyKnownDocumentsIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:statically-known-document-type
- *  
- * Author: Zorba Team
- */
-class StaticallyKnownDocumentTypeIterator : public NaryBaseIterator<StaticallyKnownDocumentTypeIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(StaticallyKnownDocumentTypeIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(StaticallyKnownDocumentTypeIterator,
-    NaryBaseIterator<StaticallyKnownDocumentTypeIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  StaticallyKnownDocumentTypeIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<StaticallyKnownDocumentTypeIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~StaticallyKnownDocumentTypeIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:statically-known-collations
- *  
- * Author: Zorba Team
- */
-class StaticallyKnownCollationsIteratorState : public PlanIteratorState
-{
-public:
-  std::vector < std::string > theCollations; //vector of collation uris
-  ulong thePosition; //current position
-
-  StaticallyKnownCollationsIteratorState();
-
-  ~StaticallyKnownCollationsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class StaticallyKnownCollationsIterator : public NaryBaseIterator<StaticallyKnownCollationsIterator, StaticallyKnownCollationsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(StaticallyKnownCollationsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(StaticallyKnownCollationsIterator,
-    NaryBaseIterator<StaticallyKnownCollationsIterator, StaticallyKnownCollationsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  StaticallyKnownCollationsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<StaticallyKnownCollationsIterator, StaticallyKnownCollationsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~StaticallyKnownCollationsIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:construction-mode
- *  
- * Author: Zorba Team
- */
-class ConstructionModeIterator : public NaryBaseIterator<ConstructionModeIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(ConstructionModeIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(ConstructionModeIterator,
-    NaryBaseIterator<ConstructionModeIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  ConstructionModeIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<ConstructionModeIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~ConstructionModeIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:ordering-mode
- *  
- * Author: Zorba Team
- */
-class OrderingModeIterator : public NaryBaseIterator<OrderingModeIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(OrderingModeIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(OrderingModeIterator,
-    NaryBaseIterator<OrderingModeIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  OrderingModeIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<OrderingModeIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~OrderingModeIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:default-order
- *  
- * Author: Zorba Team
- */
-class DefaultOrderIterator : public NaryBaseIterator<DefaultOrderIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(DefaultOrderIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(DefaultOrderIterator,
-    NaryBaseIterator<DefaultOrderIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  DefaultOrderIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<DefaultOrderIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~DefaultOrderIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:boundary-space-policy
- *  
- * Author: Zorba Team
- */
-class BoundarySpacePolicyIterator : public NaryBaseIterator<BoundarySpacePolicyIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(BoundarySpacePolicyIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(BoundarySpacePolicyIterator,
-    NaryBaseIterator<BoundarySpacePolicyIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  BoundarySpacePolicyIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<BoundarySpacePolicyIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~BoundarySpacePolicyIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:copy-namespaces-mode
- *  
- * Author: Zorba Team
- */
-class CopyNamespacesModeIterator : public NaryBaseIterator<CopyNamespacesModeIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(CopyNamespacesModeIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(CopyNamespacesModeIterator,
-    NaryBaseIterator<CopyNamespacesModeIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  CopyNamespacesModeIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<CopyNamespacesModeIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~CopyNamespacesModeIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:function-names
- *  
- * Author: Zorba Team
- */
-class FunctionNamesIteratorState : public PlanIteratorState
-{
-public:
-  std::vector < function *> theFunctions; //vector of functions
-  ulong thePosition; //current position
-
-  FunctionNamesIteratorState();
-
-  ~FunctionNamesIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class FunctionNamesIterator : public NaryBaseIterator<FunctionNamesIterator, FunctionNamesIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(FunctionNamesIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(FunctionNamesIterator,
-    NaryBaseIterator<FunctionNamesIterator, FunctionNamesIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  FunctionNamesIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<FunctionNamesIterator, FunctionNamesIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~FunctionNamesIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:function-arguments-count
- *  
- * Author: Zorba Team
- */
-class FunctionArgumentsCountIteratorState : public PlanIteratorState
-{
-public:
-  std::vector < int > arities; //vector of arities
-  unsigned int position; //current position
-
-  FunctionArgumentsCountIteratorState();
-
-  ~FunctionArgumentsCountIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class FunctionArgumentsCountIterator : public NaryBaseIterator<FunctionArgumentsCountIterator, FunctionArgumentsCountIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(FunctionArgumentsCountIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(FunctionArgumentsCountIterator,
-    NaryBaseIterator<FunctionArgumentsCountIterator, FunctionArgumentsCountIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  FunctionArgumentsCountIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<FunctionArgumentsCountIterator, FunctionArgumentsCountIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~FunctionArgumentsCountIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:in-scope-schema-types
- *  
- * Author: Zorba Team
- */
-class InScopeSchemaTypesIteratorState : public PlanIteratorState
-{
-public:
-  unsigned int ns_pos; //current position
-  unsigned int elem_pos; //current position
-
-  InScopeSchemaTypesIteratorState();
-
-  ~InScopeSchemaTypesIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class InScopeSchemaTypesIterator : public NaryBaseIterator<InScopeSchemaTypesIterator, InScopeSchemaTypesIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(InScopeSchemaTypesIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InScopeSchemaTypesIterator,
-    NaryBaseIterator<InScopeSchemaTypesIterator, InScopeSchemaTypesIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  InScopeSchemaTypesIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<InScopeSchemaTypesIterator, InScopeSchemaTypesIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~InScopeSchemaTypesIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:in-scope-element-declarations
- *  
- * Author: Zorba Team
- */
-class InScopeElementDeclarationsIteratorState : public PlanIteratorState
-{
-public:
-  unsigned int ns_pos; //current position
-  unsigned int elem_pos; //current position
-
-  InScopeElementDeclarationsIteratorState();
-
-  ~InScopeElementDeclarationsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class InScopeElementDeclarationsIterator : public NaryBaseIterator<InScopeElementDeclarationsIterator, InScopeElementDeclarationsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(InScopeElementDeclarationsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InScopeElementDeclarationsIterator,
-    NaryBaseIterator<InScopeElementDeclarationsIterator, InScopeElementDeclarationsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  InScopeElementDeclarationsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<InScopeElementDeclarationsIterator, InScopeElementDeclarationsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~InScopeElementDeclarationsIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:in-scope-attribute-declarations
- *  
- * Author: Zorba Team
- */
-class InScopeAttributeDeclarationsIteratorState : public PlanIteratorState
-{
-public:
-  unsigned int ns_pos; //current position
-  unsigned int elem_pos; //current position
-
-  InScopeAttributeDeclarationsIteratorState();
-
-  ~InScopeAttributeDeclarationsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class InScopeAttributeDeclarationsIterator : public NaryBaseIterator<InScopeAttributeDeclarationsIterator, InScopeAttributeDeclarationsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(InScopeAttributeDeclarationsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InScopeAttributeDeclarationsIterator,
-    NaryBaseIterator<InScopeAttributeDeclarationsIterator, InScopeAttributeDeclarationsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  InScopeAttributeDeclarationsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<InScopeAttributeDeclarationsIterator, InScopeAttributeDeclarationsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~InScopeAttributeDeclarationsIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:in-scope-schema-types
- *  
- * Author: Zorba Team
- */
-class InScopeElementGroupsIteratorState : public PlanIteratorState
-{
-public:
-  unsigned int ns_pos; //current position
-  unsigned int elem_pos; //current position
-
-  InScopeElementGroupsIteratorState();
-
-  ~InScopeElementGroupsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class InScopeElementGroupsIterator : public NaryBaseIterator<InScopeElementGroupsIterator, InScopeElementGroupsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(InScopeElementGroupsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InScopeElementGroupsIterator,
-    NaryBaseIterator<InScopeElementGroupsIterator, InScopeElementGroupsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  InScopeElementGroupsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<InScopeElementGroupsIterator, InScopeElementGroupsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~InScopeElementGroupsIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    sc:in-scope-schema-types
- *  
- * Author: Zorba Team
- */
-class InScopeAttributeGroupsIteratorState : public PlanIteratorState
-{
-public:
-  unsigned int ns_pos; //current position
-  unsigned int elem_pos; //current position
-
-  InScopeAttributeGroupsIteratorState();
-
-  ~InScopeAttributeGroupsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class InScopeAttributeGroupsIterator : public NaryBaseIterator<InScopeAttributeGroupsIterator, InScopeAttributeGroupsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(InScopeAttributeGroupsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InScopeAttributeGroupsIterator,
-    NaryBaseIterator<InScopeAttributeGroupsIterator, InScopeAttributeGroupsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  InScopeAttributeGroupsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<InScopeAttributeGroupsIterator, InScopeAttributeGroupsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~InScopeAttributeGroupsIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *      sc:option
- *    
- * Author: Zorba Team
- */
-class OptionIterator : public NaryBaseIterator<OptionIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(OptionIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(OptionIterator,
-    NaryBaseIterator<OptionIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  OptionIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<OptionIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~OptionIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *      sc:option
- *    
- * Author: Zorba Team
- */
-class FunctionAnnotationsIteratorState : public PlanIteratorState
-{
-public:
-  const function* theFunction; //the function
-  ulong thePosition; //current position
-
-  FunctionAnnotationsIteratorState();
-
-  ~FunctionAnnotationsIteratorState();
-
-  void init(PlanState&);
-  void reset(PlanState&);
-};
-
-class FunctionAnnotationsIterator : public NaryBaseIterator<FunctionAnnotationsIterator, FunctionAnnotationsIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(FunctionAnnotationsIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(FunctionAnnotationsIterator,
-    NaryBaseIterator<FunctionAnnotationsIterator, FunctionAnnotationsIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  FunctionAnnotationsIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<FunctionAnnotationsIterator, FunctionAnnotationsIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~FunctionAnnotationsIterator();
+ * Author: 
+ */
+class SctxDefaultCollectionTypeIterator : public NaryBaseIterator<SctxDefaultCollectionTypeIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxDefaultCollectionTypeIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxDefaultCollectionTypeIterator,
+    NaryBaseIterator<SctxDefaultCollectionTypeIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxDefaultCollectionTypeIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxDefaultCollectionTypeIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxDefaultCollectionTypeIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxDefaultFunctionNamespaceIterator : public NaryBaseIterator<SctxDefaultFunctionNamespaceIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxDefaultFunctionNamespaceIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxDefaultFunctionNamespaceIterator,
+    NaryBaseIterator<SctxDefaultFunctionNamespaceIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxDefaultFunctionNamespaceIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxDefaultFunctionNamespaceIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxDefaultFunctionNamespaceIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxDefaultOrderIterator : public NaryBaseIterator<SctxDefaultOrderIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxDefaultOrderIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxDefaultOrderIterator,
+    NaryBaseIterator<SctxDefaultOrderIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxDefaultOrderIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxDefaultOrderIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxDefaultOrderIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxFunctionAnnotationsIteratorState : public PlanIteratorState
+{
+public:
+  const function* theFunction; //
+  unsigned long thePosition; //
+
+  SctxFunctionAnnotationsIteratorState();
+
+  ~SctxFunctionAnnotationsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxFunctionAnnotationsIterator : public NaryBaseIterator<SctxFunctionAnnotationsIterator, SctxFunctionAnnotationsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxFunctionAnnotationsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxFunctionAnnotationsIterator,
+    NaryBaseIterator<SctxFunctionAnnotationsIterator, SctxFunctionAnnotationsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxFunctionAnnotationsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxFunctionAnnotationsIterator, SctxFunctionAnnotationsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxFunctionAnnotationsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxFunctionArgumentsCountIteratorState : public PlanIteratorState
+{
+public:
+  std::vector<int> arities_; //
+  std::vector<int>::const_iterator it_; //
+
+  SctxFunctionArgumentsCountIteratorState();
+
+  ~SctxFunctionArgumentsCountIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxFunctionArgumentsCountIterator : public NaryBaseIterator<SctxFunctionArgumentsCountIterator, SctxFunctionArgumentsCountIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxFunctionArgumentsCountIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxFunctionArgumentsCountIterator,
+    NaryBaseIterator<SctxFunctionArgumentsCountIterator, SctxFunctionArgumentsCountIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxFunctionArgumentsCountIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxFunctionArgumentsCountIterator, SctxFunctionArgumentsCountIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxFunctionArgumentsCountIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxFunctionNamesIteratorState : public PlanIteratorState
+{
+public:
+  std::vector<function*> theFunctions; //
+  unsigned long thePosition; //
+
+  SctxFunctionNamesIteratorState();
+
+  ~SctxFunctionNamesIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxFunctionNamesIterator : public NaryBaseIterator<SctxFunctionNamesIterator, SctxFunctionNamesIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxFunctionNamesIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxFunctionNamesIterator,
+    NaryBaseIterator<SctxFunctionNamesIterator, SctxFunctionNamesIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxFunctionNamesIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxFunctionNamesIterator, SctxFunctionNamesIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxFunctionNamesIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxFunctionsIteratorState : public PlanIteratorState
+{
+public:
+  std::vector<function*> funcs_; //
+  std::vector<function*>::const_iterator it_; //
+
+  SctxFunctionsIteratorState();
+
+  ~SctxFunctionsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxFunctionsIterator : public NaryBaseIterator<SctxFunctionsIterator, SctxFunctionsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxFunctionsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxFunctionsIterator,
+    NaryBaseIterator<SctxFunctionsIterator, SctxFunctionsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxFunctionsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxFunctionsIterator, SctxFunctionsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxFunctionsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxInScopeAttributeDeclarationsIteratorState : public PlanIteratorState
+{
+public:
+  unsigned ns_pos; //
+  unsigned elem_pos; //
+
+  SctxInScopeAttributeDeclarationsIteratorState();
+
+  ~SctxInScopeAttributeDeclarationsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxInScopeAttributeDeclarationsIterator : public NaryBaseIterator<SctxInScopeAttributeDeclarationsIterator, SctxInScopeAttributeDeclarationsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxInScopeAttributeDeclarationsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxInScopeAttributeDeclarationsIterator,
+    NaryBaseIterator<SctxInScopeAttributeDeclarationsIterator, SctxInScopeAttributeDeclarationsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxInScopeAttributeDeclarationsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxInScopeAttributeDeclarationsIterator, SctxInScopeAttributeDeclarationsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxInScopeAttributeDeclarationsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxInScopeAttributeGroupsIteratorState : public PlanIteratorState
+{
+public:
+  unsigned ns_pos; //
+  unsigned elem_pos; //
+
+  SctxInScopeAttributeGroupsIteratorState();
+
+  ~SctxInScopeAttributeGroupsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxInScopeAttributeGroupsIterator : public NaryBaseIterator<SctxInScopeAttributeGroupsIterator, SctxInScopeAttributeGroupsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxInScopeAttributeGroupsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxInScopeAttributeGroupsIterator,
+    NaryBaseIterator<SctxInScopeAttributeGroupsIterator, SctxInScopeAttributeGroupsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxInScopeAttributeGroupsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxInScopeAttributeGroupsIterator, SctxInScopeAttributeGroupsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxInScopeAttributeGroupsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxInScopeElementDeclarationsIteratorState : public PlanIteratorState
+{
+public:
+  unsigned ns_pos; //
+  unsigned elem_pos; //
+
+  SctxInScopeElementDeclarationsIteratorState();
+
+  ~SctxInScopeElementDeclarationsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxInScopeElementDeclarationsIterator : public NaryBaseIterator<SctxInScopeElementDeclarationsIterator, SctxInScopeElementDeclarationsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxInScopeElementDeclarationsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxInScopeElementDeclarationsIterator,
+    NaryBaseIterator<SctxInScopeElementDeclarationsIterator, SctxInScopeElementDeclarationsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxInScopeElementDeclarationsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxInScopeElementDeclarationsIterator, SctxInScopeElementDeclarationsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxInScopeElementDeclarationsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxInScopeElementGroupsIteratorState : public PlanIteratorState
+{
+public:
+  unsigned ns_pos; //
+  unsigned elem_pos; //
+
+  SctxInScopeElementGroupsIteratorState();
+
+  ~SctxInScopeElementGroupsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxInScopeElementGroupsIterator : public NaryBaseIterator<SctxInScopeElementGroupsIterator, SctxInScopeElementGroupsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxInScopeElementGroupsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxInScopeElementGroupsIterator,
+    NaryBaseIterator<SctxInScopeElementGroupsIterator, SctxInScopeElementGroupsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxInScopeElementGroupsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxInScopeElementGroupsIterator, SctxInScopeElementGroupsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxInScopeElementGroupsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxInScopeSchemaTypesIteratorState : public PlanIteratorState
+{
+public:
+  unsigned ns_pos; //
+  unsigned elem_pos; //
+
+  SctxInScopeSchemaTypesIteratorState();
+
+  ~SctxInScopeSchemaTypesIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxInScopeSchemaTypesIterator : public NaryBaseIterator<SctxInScopeSchemaTypesIterator, SctxInScopeSchemaTypesIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxInScopeSchemaTypesIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxInScopeSchemaTypesIterator,
+    NaryBaseIterator<SctxInScopeSchemaTypesIterator, SctxInScopeSchemaTypesIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxInScopeSchemaTypesIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxInScopeSchemaTypesIterator, SctxInScopeSchemaTypesIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxInScopeSchemaTypesIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxInscopeVariablesIteratorState : public PlanIteratorState
+{
+public:
+  std::vector<VarInfo*> vars_; //
+  std::vector<VarInfo*>::const_iterator it_; //
+  csize thePosition; //
+
+  SctxInscopeVariablesIteratorState();
+
+  ~SctxInscopeVariablesIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxInscopeVariablesIterator : public NaryBaseIterator<SctxInscopeVariablesIterator, SctxInscopeVariablesIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxInscopeVariablesIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxInscopeVariablesIterator,
+    NaryBaseIterator<SctxInscopeVariablesIterator, SctxInscopeVariablesIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxInscopeVariablesIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxInscopeVariablesIterator, SctxInscopeVariablesIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxInscopeVariablesIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxOptionIterator : public NaryBaseIterator<SctxOptionIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxOptionIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxOptionIterator,
+    NaryBaseIterator<SctxOptionIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxOptionIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxOptionIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxOptionIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxOrderingModeIterator : public NaryBaseIterator<SctxOrderingModeIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxOrderingModeIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxOrderingModeIterator,
+    NaryBaseIterator<SctxOrderingModeIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxOrderingModeIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxOrderingModeIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxOrderingModeIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxStaticallyKnownCollationsIteratorState : public PlanIteratorState
+{
+public:
+  std::vector<std::string> coll_; //
+  std::vector<std::string>::const_iterator it_; //
+
+  SctxStaticallyKnownCollationsIteratorState();
+
+  ~SctxStaticallyKnownCollationsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxStaticallyKnownCollationsIterator : public NaryBaseIterator<SctxStaticallyKnownCollationsIterator, SctxStaticallyKnownCollationsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxStaticallyKnownCollationsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxStaticallyKnownCollationsIterator,
+    NaryBaseIterator<SctxStaticallyKnownCollationsIterator, SctxStaticallyKnownCollationsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxStaticallyKnownCollationsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxStaticallyKnownCollationsIterator, SctxStaticallyKnownCollationsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxStaticallyKnownCollationsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxStaticallyKnownDocumentsIteratorState : public PlanIteratorState
+{
+public:
+  std::vector<zstring> docs_; //
+  std::vector<zstring>::const_iterator it_; //
+
+  SctxStaticallyKnownDocumentsIteratorState();
+
+  ~SctxStaticallyKnownDocumentsIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxStaticallyKnownDocumentsIterator : public NaryBaseIterator<SctxStaticallyKnownDocumentsIterator, SctxStaticallyKnownDocumentsIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxStaticallyKnownDocumentsIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxStaticallyKnownDocumentsIterator,
+    NaryBaseIterator<SctxStaticallyKnownDocumentsIterator, SctxStaticallyKnownDocumentsIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxStaticallyKnownDocumentsIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxStaticallyKnownDocumentsIterator, SctxStaticallyKnownDocumentsIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxStaticallyKnownDocumentsIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxStaticallyKnownDocumentTypeIterator : public NaryBaseIterator<SctxStaticallyKnownDocumentTypeIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxStaticallyKnownDocumentTypeIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxStaticallyKnownDocumentTypeIterator,
+    NaryBaseIterator<SctxStaticallyKnownDocumentTypeIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxStaticallyKnownDocumentTypeIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxStaticallyKnownDocumentTypeIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxStaticallyKnownDocumentTypeIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxStaticallyKnownNamespaceBindingIterator : public NaryBaseIterator<SctxStaticallyKnownNamespaceBindingIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxStaticallyKnownNamespaceBindingIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxStaticallyKnownNamespaceBindingIterator,
+    NaryBaseIterator<SctxStaticallyKnownNamespaceBindingIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxStaticallyKnownNamespaceBindingIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxStaticallyKnownNamespaceBindingIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxStaticallyKnownNamespaceBindingIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxStaticallyKnownNamespacesIteratorState : public PlanIteratorState
+{
+public:
+  store::NsBindings bindings_; //
+  store::NsBindings::const_iterator it_; //
+
+  SctxStaticallyKnownNamespacesIteratorState();
+
+  ~SctxStaticallyKnownNamespacesIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class SctxStaticallyKnownNamespacesIterator : public NaryBaseIterator<SctxStaticallyKnownNamespacesIterator, SctxStaticallyKnownNamespacesIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxStaticallyKnownNamespacesIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxStaticallyKnownNamespacesIterator,
+    NaryBaseIterator<SctxStaticallyKnownNamespacesIterator, SctxStaticallyKnownNamespacesIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxStaticallyKnownNamespacesIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxStaticallyKnownNamespacesIterator, SctxStaticallyKnownNamespacesIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxStaticallyKnownNamespacesIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: 
+ */
+class SctxXPath10CompatModeIterator : public NaryBaseIterator<SctxXPath10CompatModeIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(SctxXPath10CompatModeIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(SctxXPath10CompatModeIterator,
+    NaryBaseIterator<SctxXPath10CompatModeIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  SctxXPath10CompatModeIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<SctxXPath10CompatModeIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~SctxXPath10CompatModeIterator();
 
   void accept(PlanIterVisitor& v) const;
 

=== renamed file 'src/runtime/introspection/sctx_impl.cpp' => 'src/runtime/sctx/sctx_impl.cpp'
--- src/runtime/introspection/sctx_impl.cpp	2013-05-08 20:14:47 +0000
+++ src/runtime/sctx/sctx_impl.cpp	2013-10-01 03:26:58 +0000
@@ -15,478 +15,251 @@
  */
 #include "stdafx.h"
 
-#include <fstream>
+#include <zorba/internal/cxx_util.h>
 
+#include "context/dynamic_context.h"
+#include "context/static_context.h"
+#include "context/static_context_consts.h"
+#include "context/static_context_consts.h"
 #include "diagnostics/assert.h"
 #include "diagnostics/xquery_diagnostics.h"
-#include "zorbatypes/integer.h"
-#include "zorbatypes/numconversions.h"
-
-#include "system/globalenv.h"
-
-#include "context/static_context.h"
-#include "context/static_context_consts.h"
-#include "context/dynamic_context.h"
-#include "context/static_context_consts.h"
-
-#include "runtime/introspection/sctx.h"
-
 #include "functions/function.h"
-
+#include "runtime/sctx/sctx.h"
+#include "store/api/collection.h"
 #include "store/api/item_factory.h"
 #include "store/api/iterator.h"
-#include "store/api/collection.h"
 #include "store/api/store.h"
-
-
+#include "system/globalenv.h"
 #ifndef ZORBA_NO_XMLSCHEMA
-#include "types/schema/xercesIncludes.h"
+#include "types/schema/PrintSchema.h"
 #include "types/schema/schema.h"
-#include "types/schema/PrintSchema.h"
 #include "types/schema/StrX.h"
-#endif // #ifndef ZORBA_NO_XMLSCHEMA
+#include "types/schema/xercesIncludes.h"
+#endif /* ZORBA_NO_XMLSCHEMA */
+#include "zorbatypes/integer.h"
+#include "zorbatypes/numconversions.h"
 
+using namespace std;
 
 namespace zorba {
 
-/*******************************************************************************
-
-********************************************************************************/
-StaticNamespacesIteratorState::~StaticNamespacesIteratorState()
-{
-}
-
-
-void StaticNamespacesIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  thePosition = 0;
-  theBindings.clear();
-}
-
-
-bool StaticNamespacesIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  StaticNamespacesIteratorState* lState;
-  zstring prefix;
-
-  DEFAULT_STACK_INIT(StaticNamespacesIteratorState, lState, aPlanState);
-
-  theSctx->get_namespace_bindings(lState->theBindings);
-  lState->thePosition = 0;
-
-  while (lState->thePosition < lState->theBindings.size())
-  {
-    prefix = lState->theBindings[lState->thePosition].first;
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, prefix), lState);
-    ++lState->thePosition;
-  }
-
-  STACK_END (lState);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool StaticNamespaceBindingIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  store::Item_t lName;
-  zstring ns;
-
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  consumeNext(lName, theChildren[0].getp(), aPlanState);
-
-  if (theSctx->lookup_ns(ns, lName->getStringValue(), loc, false))
-  {
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, ns), state);
-  }
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-InscopeVariablesIteratorState::~InscopeVariablesIteratorState()
-{
-}
-
-
-void InscopeVariablesIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  thePosition = 0;
-  theVariables.clear();
-}
-
-
-bool InscopeVariablesIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  InscopeVariablesIteratorState* state;
-  DEFAULT_STACK_INIT(InscopeVariablesIteratorState, state, aPlanState);
-
-  theSctx->getVariables(state->theVariables);
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxBaseUriIterator::nextImpl( store::Item_t &result,
+                                    PlanState &plan_state ) const {
+  zstring uri( theSctx->get_base_uri() );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+  if ( !uri.empty() )
+    STACK_PUSH( GENV_ITEMFACTORY->createString( result, uri ), state );
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxBoundarySpacePolicyIterator::nextImpl( store::Item_t &result,
+                                                PlanState &plan_state ) const {
+  zstring policy(
+    theSctx->boundary_space_mode() == StaticContextConsts::preserve_space ?
+    "preserve" : "strip"
+  );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, policy );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxConstructionModeIterator::nextImpl( store::Item_t &result,
+                                             PlanState &plan_state ) const {
+  zstring mode(
+    theSctx->construction_mode() == StaticContextConsts::cons_preserve ?
+    "preserve" : "strip"
+  );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, mode );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxCopyNamespacesModeIterator::nextImpl( store::Item_t &result,
+                                               PlanState &plan_state ) const {
+  zstring inherit( theSctx->inherit_ns() ? "inherit" : "no-inherit" );
+  zstring preserve( theSctx->preserve_ns() ? "preserve" : "no-preserve" );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  STACK_PUSH( GENV_ITEMFACTORY->createString( result, inherit ), state );
+  STACK_PUSH( GENV_ITEMFACTORY->createString( result, preserve ), state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxDefaultCollationIterator::nextImpl( store::Item_t& result,
+                                             PlanState &plan_state ) const {
+  zstring collation( theSctx->get_default_collation( loc ) );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, collation );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxDefaultCollectionTypeIterator::
+nextImpl( store::Item_t& result, PlanState &plan_state ) const {
+  zstring type( theSctx->get_default_w3c_collection_type()->toSchemaString() );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, type );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxDefaultFunctionNamespaceIterator::
+nextImpl( store::Item_t& result, PlanState &plan_state ) const {
+  zstring ns( static_context::W3C_FN_NS );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, ns );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxDefaultOrderIterator::nextImpl( store::Item_t &result,
+                                         PlanState &plan_state ) const {
+  zstring order(
+    theSctx->empty_order_mode() == StaticContextConsts::empty_greatest ?
+    "greatest" : "least"
+  );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, order );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxFunctionAnnotationsIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset(plan_state);
+  theFunction = nullptr;
+  thePosition = 0;
+}
+
+bool SctxFunctionAnnotationsIterator::nextImpl( store::Item_t& result,
+                                                PlanState &plan_state ) const {
+  store::Item_t      lName;
+  store::Item_t      lArity;
+  store::Item_t      temp;
+  xs_int             arity;
+
+  SctxFunctionAnnotationsIteratorState *state;
+  DEFAULT_STACK_INIT( SctxFunctionAnnotationsIteratorState, state, plan_state );
+
+  consumeNext(lName, theChildren[0].getp(), plan_state);
+  consumeNext(lArity, theChildren[1].getp(), plan_state);
+
+  try {
+    arity = to_xs_int( lArity->getIntegerValue() );
+  }
+  catch ( std::range_error const& ) {
+    throw XQUERY_EXCEPTION(
+      err::XPTY0004,
+      ERROR_PARAMS( ZED( NoCastToCInt_2 ), lArity->getIntegerValue() ),
+      ERROR_LOC( loc )
+    );
+  }
+
+  state->theFunction = theSctx->lookup_fn( lName.getp(), arity );
   state->thePosition = 0;
+  if ( state->theFunction && !state->theFunction->getAnnotationList() )
+    state->theFunction = nullptr;
 
-  while (state->thePosition < state->theVariables.size())
+  while (state->theFunction
+         &&
+         state->thePosition < state->theFunction->getAnnotationList()->size())
   {
-    aResult = state->theVariables[state->thePosition]->getName();
+    result = state->theFunction->getAnnotationList()->get(state->thePosition)->getQName();
     STACK_PUSH(true, state);
     ++state->thePosition;
   }
 
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool DefaultCollectionTypeIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  store::Item_t lName;
-  zstring typeString;
-
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  typeString = theSctx->get_default_w3c_collection_type()->toSchemaString();
-
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, typeString), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool XPath10CompatModeIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult,
-                                             theSctx->xpath_compatibility() == StaticContextConsts::xpath1_0_only), state);
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-StaticallyKnownDocumentsIteratorState::~StaticallyKnownDocumentsIteratorState()
-{
-}
-
-
-void StaticallyKnownDocumentsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  thePosition = 0;
-  theDocuments.clear();
-}
-
-
-bool StaticallyKnownDocumentsIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  StaticallyKnownDocumentsIteratorState* state;
-  DEFAULT_STACK_INIT(StaticallyKnownDocumentsIteratorState, state, aPlanState);
-
-  theSctx->get_all_documents(state->theDocuments);
-  state->thePosition = 0;
-  while (state->thePosition < state->theDocuments.size())
-  {
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, state->theDocuments[state->thePosition]), state);
-    ++state->thePosition;
-  }
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool StaticallyKnownDocumentTypeIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  PlanIteratorState* state;
-  store::Item_t lName;
-  zstring temp_str;
-  xqtref_t type;
-
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  consumeNext(lName, theChildren[0].getp(), aPlanState);
-
-  type = theSctx->lookup_document(lName->getStringValue());
-
-  if (type.getp() == NULL)
-  {
-    temp_str = "document-node()?"; // as per http://www.w3.org/TR/xquery/#dt-known-docs
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp_str), state);
-  }
-  else
-  {
-    temp_str = type->toSchemaString();
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp_str), state);
-  }
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-StaticallyKnownCollationsIteratorState::~StaticallyKnownCollationsIteratorState()
-{
-}
-
-void StaticallyKnownCollationsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  thePosition = 0;
-  theCollations.clear();
-}
-
-
-bool StaticallyKnownCollationsIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  zstring temp;
-
-  StaticallyKnownCollationsIteratorState* state;
-  DEFAULT_STACK_INIT(StaticallyKnownCollationsIteratorState, state, aPlanState);
-
-  theSctx->get_collations(state->theCollations);
-  state->thePosition = 0;
-
-  while (state->thePosition < state->theCollations.size())
-  {
-    temp = state->theCollations.at(state->thePosition);
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-    ++state->thePosition;
-  }
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool DefaultFunctionNamespaceIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  zstring temp = static_context::W3C_FN_NS;
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool SctxBaseUriIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  zstring temp = theSctx->get_base_uri();
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  if (!temp.empty())
-    STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool SctxDefaultCollationIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  zstring temp = theSctx->get_default_collation(loc);
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool ConstructionModeIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  zstring temp;
-
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  if (theSctx->construction_mode() == StaticContextConsts::cons_preserve)
-    temp = "preserve";
-  else
-    temp = "strip";
-
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool OrderingModeIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  PlanIteratorState* state;
-  zstring temp;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  if (theSctx->ordering_mode() == StaticContextConsts::ordered)
-    temp = "ordered";
-  else
-    temp = "unordered";
-
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool DefaultOrderIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  PlanIteratorState* state;
-  zstring temp;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  if (theSctx->empty_order_mode() == StaticContextConsts::empty_greatest)
-    temp = "greatest";
-  else
-    temp = "least";
-
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool BoundarySpacePolicyIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  zstring temp;
-
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  if (theSctx->boundary_space_mode() == StaticContextConsts::preserve_space)
-    temp = "preserve";
-  else
-    temp = "strip";
-
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, temp), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool CopyNamespacesModeIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  PlanIteratorState* state;
-  zstring inherit, preserve;
-
-  if (theSctx->inherit_ns())
-    inherit = "inherit";
-  else
-    inherit = "no-inherit";
-
-  if (theSctx->preserve_ns())
-    preserve = "preserve";
-  else
-    preserve = "no-preserve";
-
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, inherit), state);
-  STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, preserve), state);
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-FunctionNamesIteratorState::~FunctionNamesIteratorState()
-{
-}
-
-
-void FunctionNamesIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  thePosition = 0;
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxFunctionArgumentsCountIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  arities_.clear();
+}
+
+bool SctxFunctionArgumentsCountIterator::
+nextImpl( store::Item_t &result, PlanState &plan_state ) const {
+  store::Item_t lName;
+  std::vector<function*> funcs;
+
+  SctxFunctionArgumentsCountIteratorState *state;
+  DEFAULT_STACK_INIT( SctxFunctionArgumentsCountIteratorState, state, plan_state );
+
+  consumeNext( lName, theChildren[0].getp(), plan_state );
+  theSctx->find_functions( lName, funcs );
+  FOR_EACH( std::vector<function*>, f, funcs )
+    if ( (*f)->getXQueryVersion() <= theSctx->xquery_version() )
+      state->arities_.push_back( (*f)->getArity() );
+
+  for ( state->it_ = state->arities_.begin();
+        state->it_ != state->arities_.end(); ++state->it_ ) {
+    GENV_ITEMFACTORY->createInt( result, *state->it_ );
+    STACK_PUSH( true, state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxFunctionNamesIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
   theFunctions.clear();
+  thePosition = 0;
 }
 
-
-bool FunctionNamesIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  FunctionNamesIteratorState* state;
+bool SctxFunctionNamesIterator::nextImpl( store::Item_t &result,
+                                          PlanState &plan_state) const {
   bool already_returned;
 
-  DEFAULT_STACK_INIT(FunctionNamesIteratorState, state, aPlanState);
+  SctxFunctionNamesIteratorState *state;
+  DEFAULT_STACK_INIT( SctxFunctionNamesIteratorState, state, plan_state );
 
-  theSctx->get_functions(state->theFunctions);
+  theSctx->get_functions( state->theFunctions );
   state->thePosition = 0;
-  while (state->thePosition < state->theFunctions.size())
-  {
-    aResult = state->theFunctions[state->thePosition]->getName();
+  while ( state->thePosition < state->theFunctions.size() ) {
+    result = state->theFunctions[state->thePosition]->getName();
     already_returned = false;
 
-    for (unsigned int i = 0; i < state->thePosition; ++i)
-    {
+    for ( unsigned i = 0; i < state->thePosition; ++i ) {
       if (state->theFunctions[i]->getName()->equals(state->theFunctions[state->thePosition]->getName())
           &&
           state->theFunctions[i]->getXQueryVersion() <= theSctx->xquery_version())
@@ -507,100 +280,406 @@
     ++state->thePosition;
   }
 
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-bool FunctionArgumentsCountIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  FunctionArgumentsCountIteratorState* lState;
-  store::Item_t lName;
-  std::vector<function*> funcs;
-
-  DEFAULT_STACK_INIT(FunctionArgumentsCountIteratorState, lState, aPlanState);
-
-  consumeNext(lName, theChildren[0].getp(), aPlanState);
-  theSctx->find_functions(lName, funcs);
-  for (unsigned int i=0; i<funcs.size(); i++)
-    if (funcs[i]->getXQueryVersion() <= theSctx->xquery_version())
-      lState->arities.push_back(funcs[i]->getArity());
-
-  lState->position = 0;
-  while (lState->position < lState->arities.size())
-  {
-    STACK_PUSH( GENV_ITEMFACTORY->createInt(aResult, lState->arities[lState->position]), lState);
-    lState->position++;
-  }
-
-  STACK_END (lState);
-}
-
-FunctionArgumentsCountIteratorState::~FunctionArgumentsCountIteratorState()
-{
-}
-
-void FunctionArgumentsCountIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  position = 0;
-  arities.clear();
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-InScopeSchemaTypesIteratorState::~InScopeSchemaTypesIteratorState()
-{
-}
-
-void InScopeSchemaTypesIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  ns_pos = 0;
-  elem_pos = 0;
-}
-
-
-bool InScopeSchemaTypesIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-#ifndef ZORBA_NO_XMLSCHEMA
-  XERCES_CPP_NAMESPACE_USE;
-  zstring qname_ns;
-  bool modelHasChanged;
-  Schema* schema;
-  XMLGrammarPool* grammarPool;
-  XSModel* xsModel = NULL;
-  StringList* namespaces = NULL;
-  const XMLCh* nameSpace;
-  XSNamedMap<XSObject>* xsElements;
-  XSElementDeclaration* xsElement;
-  const XMLCh* elemNameSpace;
-
-  schema = theSctx->get_typemanager()->getSchema();
-  if (schema != NULL)
-  {
-    grammarPool = schema->getGrammarPool();
-    xsModel = grammarPool->getXSModel(modelHasChanged);
-    namespaces = xsModel->getNamespaces();
-  }
-
-  InScopeSchemaTypesIteratorState* state;
-  DEFAULT_STACK_INIT(InScopeSchemaTypesIteratorState, state, aPlanState);
-
-  state->ns_pos = 0;
-  state->elem_pos = 0;
-  while (schema != NULL && state->ns_pos < namespaces->size())
-  {
-    nameSpace = namespaces->elementAt(state->ns_pos);
-    if (nameSpace == NULL || XMLString::stringLen(nameSpace) <= 0)
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxFunctionsIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  funcs_.clear();
+}
+
+bool SctxFunctionsIterator::nextImpl( store::Item_t &result,
+                                      PlanState &plan_state) const {
+  AnnotationList const *annotations;
+  function const *func;
+  store::Item_t item;
+  vector<store::Item_t> keys, values;
+  zstring s;
+
+  SctxFunctionsIteratorState *state;
+  DEFAULT_STACK_INIT( SctxFunctionsIteratorState, state, plan_state );
+
+  theSctx->get_functions( state->funcs_ );
+  for ( state->it_ = state->funcs_.begin(); state->it_ != state->funcs_.end();
+        ++state->it_ ) {
+    func = *state->it_;
+    if ( func->getXQueryVersion() > theSctx->xquery_version() )
+      continue;
+
+    s = "name";
+    GENV_ITEMFACTORY->createString( item, s );
+    keys.push_back( item );
+    values.push_back( func->getName() );
+
+    s = "arity";
+    GENV_ITEMFACTORY->createString( item, s );
+    keys.push_back( item );
+    GENV_ITEMFACTORY->createInt( item, func->getArity() );
+    values.push_back( item );
+
+    if ( (annotations = func->getAnnotationList()) ) {
+      s = "annotations";
+      GENV_ITEMFACTORY->createString( item, s );
+      keys.push_back( item );
+
+      vector<store::Item_t> elements;
+      AnnotationList::size_type const size = annotations->size();
+      for ( AnnotationList::size_type i = 0; i < size; ++i ) {
+        item = annotations->get( i )->getQName();
+        elements.push_back( item );
+      }
+      GENV_ITEMFACTORY->createJSONArray( item, elements );
+      values.push_back( item );
+    }
+
+    GENV_ITEMFACTORY->createJSONObject( result, keys, values );
+    STACK_PUSH( true, state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxInScopeAttributeDeclarationsIteratorState::
+reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  ns_pos = 0;
+  elem_pos = 0;
+}
+
+bool SctxInScopeAttributeDeclarationsIterator::
+nextImpl( store::Item_t &result, PlanState &plan_state ) const {
+  SctxInScopeAttributeDeclarationsIteratorState *state;
+
+#ifndef ZORBA_NO_XMLSCHEMA
+  XERCES_CPP_NAMESPACE_USE;
+  zstring qname_ns;
+  bool modelHasChanged;
+  Schema* schema;
+  XMLGrammarPool* grammarPool;
+  XSModel* xsModel = nullptr;
+  StringList* namespaces = nullptr;
+  const XMLCh* nameSpace;
+  XSNamedMap<XSObject>* xsElements;
+  XSElementDeclaration* xsElement;
+  const XMLCh* elemNameSpace;
+
+  schema = theSctx->get_typemanager()->getSchema();
+  if ( schema )
+  {
+    grammarPool = schema->getGrammarPool();
+    xsModel = grammarPool->getXSModel(modelHasChanged);
+    namespaces = xsModel->getNamespaces();
+  }
+
+  DEFAULT_STACK_INIT(SctxInScopeAttributeDeclarationsIteratorState, state, plan_state);
+  state->ns_pos = 0;
+  state->elem_pos = 0;
+
+  while (schema && state->ns_pos < namespaces->size())
+  {
+    nameSpace = namespaces->elementAt(state->ns_pos);
+    if (!nameSpace || XMLString::stringLen(nameSpace) <= 0)
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElements = xsModel->getComponentsByNamespace(XSConstants::ATTRIBUTE_DECLARATION, nameSpace);
+    if (!xsElements || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
+    elemNameSpace = xsElement->getNamespace();
+    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
+      qname_ns = StrX(elemNameSpace).localForm();
+
+    state->elem_pos++;
+    STACK_PUSH(GENV_ITEMFACTORY->createQName(result, qname_ns.c_str(), "", StrX(xsElement->getName()).localForm()), state);
+  }
+
+#else /* ZORBA_NO_XMLSCHEMA */
+
+  // In case Zorba is compiled without schema, the function will return an empty sequence
+  DEFAULT_STACK_INIT(InScopeAttributeDeclarationsIteratorState, state, plan_state);
+
+#endif /* ZORBA_NO_XMLSCHEMA */
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxInScopeAttributeGroupsIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  ns_pos = 0;
+  elem_pos = 0;
+}
+
+bool SctxInScopeAttributeGroupsIterator::
+nextImpl( store::Item_t &result, PlanState &plan_state) const {
+  SctxInScopeAttributeGroupsIteratorState *state;
+
+#ifndef ZORBA_NO_XMLSCHEMA
+  XERCES_CPP_NAMESPACE_USE;
+  zstring qname_ns;
+  bool modelHasChanged;
+  Schema* schema;
+  XMLGrammarPool* grammarPool;
+  XSModel* xsModel = nullptr;
+  StringList* namespaces = nullptr;
+  const XMLCh* nameSpace;
+  XSNamedMap<XSObject>* xsElements;
+  XSElementDeclaration* xsElement;
+  const XMLCh* elemNameSpace;
+
+  schema = theSctx->get_typemanager()->getSchema();
+  if ( schema )
+  {
+    grammarPool = schema->getGrammarPool();
+    xsModel = grammarPool->getXSModel(modelHasChanged);
+    namespaces = xsModel->getNamespaces();
+  }
+
+  DEFAULT_STACK_INIT(SctxInScopeAttributeGroupsIteratorState, state, plan_state);
+
+  state->ns_pos = 0;
+  state->elem_pos = 0;
+  while (schema && state->ns_pos < namespaces->size())
+  {
+    nameSpace = namespaces->elementAt(state->ns_pos);
+    if (!nameSpace || XMLString::stringLen(nameSpace) <= 0)
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElements = xsModel->getComponentsByNamespace(XSConstants::ATTRIBUTE_GROUP_DEFINITION, nameSpace);
+    if (!xsElements || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
+    elemNameSpace = xsElement->getNamespace();
+    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
+      qname_ns = StrX(elemNameSpace).localForm();
+
+    state->elem_pos++;
+    STACK_PUSH(GENV_ITEMFACTORY->createQName(result, qname_ns.c_str(), "", StrX(xsElement->getName()).localForm()), state);
+  }
+
+#else /* ZORBA_NO_XMLSCHEMA */
+
+  // In case Zorba is compiled without schema, the function will return an empty sequence
+  DEFAULT_STACK_INIT( InScopeAttributeGroupsIteratorState, state, plan_state );
+
+#endif /* ZORBA_NO_XMLSCHEMA */
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxInScopeElementDeclarationsIteratorState::
+reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  ns_pos = 0;
+  elem_pos = 0;
+}
+
+bool SctxInScopeElementDeclarationsIterator::
+nextImpl( store::Item_t &result, PlanState &plan_state ) const {
+#ifndef ZORBA_NO_XMLSCHEMA
+  XERCES_CPP_NAMESPACE_USE;
+  zstring qname_ns;
+  bool modelHasChanged;
+  Schema* schema;
+  XMLGrammarPool* grammarPool;
+  XSModel* xsModel = nullptr;
+  StringList* namespaces = nullptr;
+  const XMLCh* nameSpace;
+  XSNamedMap<XSObject>* xsElements;
+  XSElementDeclaration* xsElement;
+  const XMLCh* elemNameSpace;
+
+  schema = theSctx->get_typemanager()->getSchema();
+  if ( schema ) {
+    grammarPool = schema->getGrammarPool();
+    xsModel = grammarPool->getXSModel(modelHasChanged);
+    namespaces = xsModel->getNamespaces();
+  }
+
+  SctxInScopeElementDeclarationsIteratorState *state;
+  DEFAULT_STACK_INIT(SctxInScopeElementDeclarationsIteratorState, state, plan_state);
+
+  state->ns_pos = 0;
+  state->elem_pos = 0;
+  while (schema && state->ns_pos < namespaces->size())
+  {
+    nameSpace = namespaces->elementAt(state->ns_pos);
+    if (!nameSpace || XMLString::stringLen(nameSpace) <= 0)
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElements = xsModel->getComponentsByNamespace(XSConstants::ELEMENT_DECLARATION, nameSpace);
+    if (!xsElements || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
+    elemNameSpace = xsElement->getNamespace();
+    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
+      qname_ns = StrX(elemNameSpace).localForm();
+
+    state->elem_pos++;
+    STACK_PUSH(GENV_ITEMFACTORY->createQName(result,
+                                             qname_ns.c_str(),
+                                             "",
+                                             StrX(xsElement->getName()).localForm()),
+                                             state);
+  }
+
+#else /* ZORBA_NO_XMLSCHEMA */
+
+  // In case Zorba is compiled without schema, the function will return an empty sequence
+  InScopeElementDeclarationsIteratorState* state;
+  DEFAULT_STACK_INIT(InScopeElementDeclarationsIteratorState, state, plan_state);
+
+#endif /* ZORBA_NO_XMLSCHEMA */
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxInScopeElementGroupsIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset(plan_state);
+  ns_pos = 0;
+  elem_pos = 0;
+}
+
+bool SctxInScopeElementGroupsIterator::nextImpl(
+    store::Item_t& result,
+    PlanState &plan_state) const
+{
+  SctxInScopeElementGroupsIteratorState* state;
+
+#ifndef ZORBA_NO_XMLSCHEMA
+  XERCES_CPP_NAMESPACE_USE;
+  zstring qname_ns;
+  bool modelHasChanged;
+  Schema* schema;
+  XMLGrammarPool* grammarPool;
+  XSModel* xsModel = nullptr;
+  StringList* namespaces = nullptr;
+  const XMLCh* nameSpace;
+  XSNamedMap<XSObject>* xsElements;
+  XSElementDeclaration* xsElement;
+  const XMLCh* elemNameSpace;
+
+  schema = theSctx->get_typemanager()->getSchema();
+  if ( schema )
+  {
+    grammarPool = schema->getGrammarPool();
+    xsModel = grammarPool->getXSModel(modelHasChanged);
+    namespaces = xsModel->getNamespaces();
+  }
+
+  DEFAULT_STACK_INIT(SctxInScopeElementGroupsIteratorState, state, plan_state);
+
+  state->ns_pos = 0;
+  state->elem_pos = 0;
+  while (schema && state->ns_pos < namespaces->size())
+  {
+    nameSpace = namespaces->elementAt(state->ns_pos);
+    if (!nameSpace || XMLString::stringLen(nameSpace) <= 0)
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElements = xsModel->getComponentsByNamespace(XSConstants::MODEL_GROUP_DEFINITION, nameSpace);
+    if (!xsElements || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
+    {
+      state->ns_pos++;
+      state->elem_pos = 0;
+      continue;
+    }
+
+    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
+    elemNameSpace = xsElement->getNamespace();
+    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
+      qname_ns = StrX(elemNameSpace).localForm();
+
+    state->elem_pos++;
+    STACK_PUSH(GENV_ITEMFACTORY->createQName(result, qname_ns.c_str(), "", StrX(xsElement->getName()).localForm()), state);
+  }
+
+#else // #ifndef ZORBA_NO_XMLSCHEMA
+
+  // In case Zorba is compiled without schema, the function will return an empty sequence
+  DEFAULT_STACK_INIT(InScopeElementGroupsIteratorState, state, plan_state);
+
+#endif // #ifndef ZORBA_NO_XMLSCHEMA
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxInScopeSchemaTypesIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset(plan_state);
+  ns_pos = 0;
+  elem_pos = 0;
+}
+
+bool SctxInScopeSchemaTypesIterator::nextImpl( store::Item_t &result,
+                                               PlanState &plan_state ) const {
+#ifndef ZORBA_NO_XMLSCHEMA
+  XERCES_CPP_NAMESPACE_USE;
+  zstring qname_ns;
+  bool modelHasChanged;
+  Schema* schema;
+  XMLGrammarPool* grammarPool;
+  XSModel* xsModel = nullptr;
+  StringList* namespaces = nullptr;
+  const XMLCh* nameSpace;
+  XSNamedMap<XSObject>* xsElements;
+  XSElementDeclaration* xsElement;
+  const XMLCh* elemNameSpace;
+
+  schema = theSctx->get_typemanager()->getSchema();
+  if ( schema )
+  {
+    grammarPool = schema->getGrammarPool();
+    xsModel = grammarPool->getXSModel(modelHasChanged);
+    namespaces = xsModel->getNamespaces();
+  }
+
+  SctxInScopeSchemaTypesIteratorState* state;
+  DEFAULT_STACK_INIT(SctxInScopeSchemaTypesIteratorState, state, plan_state);
+
+  state->ns_pos = 0;
+  state->elem_pos = 0;
+  while (schema && state->ns_pos < namespaces->size())
+  {
+    nameSpace = namespaces->elementAt(state->ns_pos);
+    if ( !nameSpace || XMLString::stringLen(nameSpace) <= 0)
     {
       state->ns_pos++;
       state->elem_pos = 0;
@@ -610,7 +689,7 @@
     xsElements = xsModel->getComponentsByNamespace(XSConstants::TYPE_DEFINITION,
                                                    nameSpace);
 
-    if (xsElements == NULL ||
+    if (!xsElements ||
         xsElements->getLength() <= 0 ||
         state->elem_pos >= xsElements->getLength())
     {
@@ -626,444 +705,219 @@
 
     state->elem_pos++;
 
-    STACK_PUSH(GENV_ITEMFACTORY->createQName(aResult,
+    STACK_PUSH(GENV_ITEMFACTORY->createQName(result,
                                              qname_ns.c_str(),
                                              "",
                                              StrX(xsElement->getName()).localForm()),
                                              state);
   }
 
-  STACK_END (state);
-
-#else // #ifndef ZORBA_NO_XMLSCHEMA
+#else /* ZORBA_NO_XMLSCHEMA */
 
   // In case Zorba is compiled without schema, the function will return an empty sequence
   // TODO: the function should return the predefined xs: types even without schema
-  InScopeSchemaTypesIteratorState* state;
-  DEFAULT_STACK_INIT(InScopeSchemaTypesIteratorState, state, aPlanState);
-  STACK_END (state);
-
-#endif // #ifndef ZORBA_NO_XMLSCHEMA
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-InScopeElementDeclarationsIteratorState::~InScopeElementDeclarationsIteratorState()
-{
-}
-
-void InScopeElementDeclarationsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  ns_pos = 0;
-  elem_pos = 0;
-}
-
-
-bool InScopeElementDeclarationsIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-#ifndef ZORBA_NO_XMLSCHEMA
-  XERCES_CPP_NAMESPACE_USE;
-  zstring qname_ns;
-  bool modelHasChanged;
-  Schema* schema;
-  XMLGrammarPool* grammarPool;
-  XSModel* xsModel = NULL;
-  StringList* namespaces = NULL;
-  const XMLCh* nameSpace;
-  XSNamedMap<XSObject>* xsElements;
-  XSElementDeclaration* xsElement;
-  const XMLCh* elemNameSpace;
-
-  schema = theSctx->get_typemanager()->getSchema();
-  if (schema != NULL)
-  {
-    grammarPool = schema->getGrammarPool();
-    xsModel = grammarPool->getXSModel(modelHasChanged);
-    namespaces = xsModel->getNamespaces();
-  }
-
-  InScopeElementDeclarationsIteratorState* state;
-  DEFAULT_STACK_INIT(InScopeElementDeclarationsIteratorState, state, aPlanState);
-
-  state->ns_pos = 0;
-  state->elem_pos = 0;
-  while (schema != NULL && state->ns_pos < namespaces->size())
-  {
-    nameSpace = namespaces->elementAt(state->ns_pos);
-    if (nameSpace == NULL || XMLString::stringLen(nameSpace) <= 0)
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElements = xsModel->getComponentsByNamespace(XSConstants::ELEMENT_DECLARATION, nameSpace);
-    if (xsElements == NULL || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
-    elemNameSpace = xsElement->getNamespace();
-    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
-      qname_ns = StrX(elemNameSpace).localForm();
-
-    state->elem_pos++;
-    STACK_PUSH(GENV_ITEMFACTORY->createQName(aResult,
-                                             qname_ns.c_str(),
-                                             "",
-                                             StrX(xsElement->getName()).localForm()),
-                                             state);
-  }
-
-  STACK_END (state);
-
-#else // #ifndef ZORBA_NO_XMLSCHEMA
-
-  // In case Zorba is compiled without schema, the function will return an empty sequence
-  InScopeElementDeclarationsIteratorState* state;
-  DEFAULT_STACK_INIT(InScopeElementDeclarationsIteratorState, state, aPlanState);
-  STACK_END (state);
-
-#endif // #ifndef ZORBA_NO_XMLSCHEMA
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-InScopeAttributeDeclarationsIteratorState::~InScopeAttributeDeclarationsIteratorState()
-{
-}
-
-void InScopeAttributeDeclarationsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  ns_pos = 0;
-  elem_pos = 0;
-}
-
-
-bool InScopeAttributeDeclarationsIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  InScopeAttributeDeclarationsIteratorState* state;
-
-#ifndef ZORBA_NO_XMLSCHEMA
-  XERCES_CPP_NAMESPACE_USE;
-  zstring qname_ns;
-  bool modelHasChanged;
-  Schema* schema;
-  XMLGrammarPool* grammarPool;
-  XSModel* xsModel = NULL;
-  StringList* namespaces = NULL;
-  const XMLCh* nameSpace;
-  XSNamedMap<XSObject>* xsElements;
-  XSElementDeclaration* xsElement;
-  const XMLCh* elemNameSpace;
-
-  schema = theSctx->get_typemanager()->getSchema();
-  if (schema != NULL)
-  {
-    grammarPool = schema->getGrammarPool();
-    xsModel = grammarPool->getXSModel(modelHasChanged);
-    namespaces = xsModel->getNamespaces();
-  }
-
-  DEFAULT_STACK_INIT(InScopeAttributeDeclarationsIteratorState, state, aPlanState);
-  state->ns_pos = 0;
-  state->elem_pos = 0;
-
-  while (schema != NULL && state->ns_pos < namespaces->size())
-  {
-    nameSpace = namespaces->elementAt(state->ns_pos);
-    if (nameSpace == NULL || XMLString::stringLen(nameSpace) <= 0)
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElements = xsModel->getComponentsByNamespace(XSConstants::ATTRIBUTE_DECLARATION, nameSpace);
-    if (xsElements == NULL || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
-    elemNameSpace = xsElement->getNamespace();
-    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
-      qname_ns = StrX(elemNameSpace).localForm();
-
-    state->elem_pos++;
-    STACK_PUSH(GENV_ITEMFACTORY->createQName(aResult, qname_ns.c_str(), "", StrX(xsElement->getName()).localForm()), state);
-  }
-  STACK_END (state);
-
-#else // #ifndef ZORBA_NO_XMLSCHEMA
-
-  // In case Zorba is compiled without schema, the function will return an empty sequence
-  DEFAULT_STACK_INIT(InScopeAttributeDeclarationsIteratorState, state, aPlanState);
-  STACK_END (state);
-
-#endif // #ifndef ZORBA_NO_XMLSCHEMA
-}
-
-/*******************************************************************************
-
-********************************************************************************/
-InScopeElementGroupsIteratorState::~InScopeElementGroupsIteratorState()
-{
-}
-
-void InScopeElementGroupsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  ns_pos = 0;
-  elem_pos = 0;
-}
-
-
-bool InScopeElementGroupsIterator::nextImpl(
-    store::Item_t& aResult,
-    PlanState& aPlanState) const
-{
-  InScopeElementGroupsIteratorState* state;
-
-#ifndef ZORBA_NO_XMLSCHEMA
-  XERCES_CPP_NAMESPACE_USE;
-  zstring qname_ns;
-  bool modelHasChanged;
-  Schema* schema;
-  XMLGrammarPool* grammarPool;
-  XSModel* xsModel = NULL;
-  StringList* namespaces = NULL;
-  const XMLCh* nameSpace;
-  XSNamedMap<XSObject>* xsElements;
-  XSElementDeclaration* xsElement;
-  const XMLCh* elemNameSpace;
-
-  schema = theSctx->get_typemanager()->getSchema();
-  if (schema != NULL)
-  {
-    grammarPool = schema->getGrammarPool();
-    xsModel = grammarPool->getXSModel(modelHasChanged);
-    namespaces = xsModel->getNamespaces();
-  }
-
-  DEFAULT_STACK_INIT(InScopeElementGroupsIteratorState, state, aPlanState);
-
-  state->ns_pos = 0;
-  state->elem_pos = 0;
-  while (schema != NULL && state->ns_pos < namespaces->size())
-  {
-    nameSpace = namespaces->elementAt(state->ns_pos);
-    if (nameSpace == NULL || XMLString::stringLen(nameSpace) <= 0)
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElements = xsModel->getComponentsByNamespace(XSConstants::MODEL_GROUP_DEFINITION, nameSpace);
-    if (xsElements == NULL || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
-    elemNameSpace = xsElement->getNamespace();
-    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
-      qname_ns = StrX(elemNameSpace).localForm();
-
-    state->elem_pos++;
-    STACK_PUSH(GENV_ITEMFACTORY->createQName(aResult, qname_ns.c_str(), "", StrX(xsElement->getName()).localForm()), state);
-  }
-  STACK_END (state);
-
-#else // #ifndef ZORBA_NO_XMLSCHEMA
-
-  // In case Zorba is compiled without schema, the function will return an empty sequence
-  DEFAULT_STACK_INIT(InScopeElementGroupsIteratorState, state, aPlanState);
-  STACK_END (state);
-
-#endif // #ifndef ZORBA_NO_XMLSCHEMA
-}
-
-/*******************************************************************************
-
-********************************************************************************/
-InScopeAttributeGroupsIteratorState::~InScopeAttributeGroupsIteratorState()
-{
-}
-
-void InScopeAttributeGroupsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  ns_pos = 0;
-  elem_pos = 0;
-}
-
-
-bool InScopeAttributeGroupsIterator::nextImpl(
-                                            store::Item_t& aResult,
-                                            PlanState& aPlanState) const
-{
-  InScopeAttributeGroupsIteratorState* state;
-
-#ifndef ZORBA_NO_XMLSCHEMA
-  XERCES_CPP_NAMESPACE_USE;
-  zstring qname_ns;
-  bool modelHasChanged;
-  Schema* schema;
-  XMLGrammarPool* grammarPool;
-  XSModel* xsModel = NULL;
-  StringList* namespaces = NULL;
-  const XMLCh* nameSpace;
-  XSNamedMap<XSObject>* xsElements;
-  XSElementDeclaration* xsElement;
-  const XMLCh* elemNameSpace;
-
-  schema = theSctx->get_typemanager()->getSchema();
-  if (schema != NULL)
-  {
-    grammarPool = schema->getGrammarPool();
-    xsModel = grammarPool->getXSModel(modelHasChanged);
-    namespaces = xsModel->getNamespaces();
-  }
-
-  DEFAULT_STACK_INIT(InScopeAttributeGroupsIteratorState, state, aPlanState);
-
-  state->ns_pos = 0;
-  state->elem_pos = 0;
-  while (schema != NULL && state->ns_pos < namespaces->size())
-  {
-    nameSpace = namespaces->elementAt(state->ns_pos);
-    if (nameSpace == NULL || XMLString::stringLen(nameSpace) <= 0)
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElements = xsModel->getComponentsByNamespace(XSConstants::ATTRIBUTE_GROUP_DEFINITION, nameSpace);
-    if (xsElements == NULL || xsElements->getLength() <= 0 || state->elem_pos >= xsElements->getLength())
-    {
-      state->ns_pos++;
-      state->elem_pos = 0;
-      continue;
-    }
-
-    xsElement = (XSElementDeclaration*)xsElements->item(state->elem_pos);
-    elemNameSpace = xsElement->getNamespace();
-    if (elemNameSpace && (XMLString::stringLen(elemNameSpace )>0))
-      qname_ns = StrX(elemNameSpace).localForm();
-
-    state->elem_pos++;
-    STACK_PUSH(GENV_ITEMFACTORY->createQName(aResult, qname_ns.c_str(), "", StrX(xsElement->getName()).localForm()), state);
-  }
-  STACK_END (state);
-
-#else // #ifndef ZORBA_NO_XMLSCHEMA
-
-  // In case Zorba is compiled without schema, the function will return an empty sequence
-  DEFAULT_STACK_INIT(InScopeAttributeGroupsIteratorState, state, aPlanState);
-  STACK_END (state);
-
-#endif // #ifndef ZORBA_NO_XMLSCHEMA
-}
-
-/*******************************************************************************
-********************************************************************************/
-bool
-OptionIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState)
-  const
-{
-  PlanIteratorState *lState;
+  SctxInScopeSchemaTypesIteratorState* state;
+  DEFAULT_STACK_INIT(SctxInScopeSchemaTypesIteratorState, state, plan_state);
+
+#endif /* ZORBA_NO_XMLSCHEMA */
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxInscopeVariablesIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset(plan_state);
+  vars_.clear();
+}
+
+bool SctxInscopeVariablesIterator::nextImpl( store::Item_t& result,
+                                             PlanState &plan_state ) const {
+  SctxInscopeVariablesIteratorState *state;
+  DEFAULT_STACK_INIT( SctxInscopeVariablesIteratorState, state, plan_state );
+
+  theSctx->getVariables( state->vars_ );
+
+  for ( state->it_ = state->vars_.begin(); state->it_ != state->vars_.end();
+        ++state->it_ ) {
+    result = (*state->it_)->getName();
+    STACK_PUSH( true, state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxOptionIterator::nextImpl( store::Item_t &result,
+                                   PlanState &plan_state ) const
+{
   store::Item_t      lName;
   zstring            lValue;
 
-  DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);
-
-  consumeNext(lName, theChildren[0].getp(), aPlanState);
-  if (theSctx->lookup_option(lName.getp(), lValue))
-  {
-    GENV_ITEMFACTORY->createString(aResult, lValue);
-    STACK_PUSH( true, lState );
-  }
-  else
-  {
-    STACK_PUSH( false, lState );
-  }
-  STACK_END (lState);
-}
-
-/*******************************************************************************
-********************************************************************************/
-FunctionAnnotationsIteratorState::~FunctionAnnotationsIteratorState()
-{
-}
-
-void FunctionAnnotationsIteratorState::reset(PlanState& planState)
-{
-  PlanIteratorState::reset(planState);
-  theFunction = NULL;
-  thePosition = 0;
-}
-
-bool
-FunctionAnnotationsIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState) const
-{
-  FunctionAnnotationsIteratorState *lState;
-  store::Item_t      lName;
-  store::Item_t      lArity;
-  store::Item_t      temp;
-  xs_int             arity;
-
-  DEFAULT_STACK_INIT(FunctionAnnotationsIteratorState, lState, aPlanState);
-
-  consumeNext(lName, theChildren[0].getp(), aPlanState);
-  consumeNext(lArity, theChildren[1].getp(), aPlanState);
-
-  try {
-    arity = to_xs_int(lArity->getIntegerValue());
-  } catch ( std::range_error const& ) {
-    throw XQUERY_EXCEPTION(
-              err::XPTY0004,
-              ERROR_PARAMS( ZED( NoCastToCInt_2 ), lArity->getIntegerValue() ),
-              ERROR_LOC( loc )
-          );
-  }
-
-  lState->theFunction = theSctx->lookup_fn(lName.getp(), arity);
-  lState->thePosition = 0;
-  if (lState->theFunction != NULL && lState->theFunction->getAnnotationList() == NULL)   // no annotations
-    lState->theFunction = NULL;
-
-  while (lState->theFunction != NULL
-         &&
-         lState->thePosition < lState->theFunction->getAnnotationList()->size())
-  {
-    aResult = lState->theFunction->getAnnotationList()->get(lState->thePosition)->getQName();
-    STACK_PUSH(true, lState);
-    ++lState->thePosition;
-  }
-
-  STACK_END (lState);
-}
-
-
-} /* namespace zorba */
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+  consumeNext( lName, theChildren[0].getp(), plan_state );
+  if ( theSctx->lookup_option( lName.getp(), lValue ) ) {
+    GENV_ITEMFACTORY->createString( result, lValue );
+    STACK_PUSH( true, state );
+  } else {
+    STACK_PUSH( false, state );
+  }
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxOrderingModeIterator::nextImpl( store::Item_t &result,
+                                         PlanState &plan_state ) const {
+  zstring mode(
+    theSctx->ordering_mode() == StaticContextConsts::ordered ?
+    "ordered" : "unordered"
+  );
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+  GENV_ITEMFACTORY->createString( result, mode );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxStaticallyKnownCollationsIteratorState::
+reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  coll_.clear();
+}
+
+bool SctxStaticallyKnownCollationsIterator::
+nextImpl( store::Item_t &result, PlanState &plan_state ) const {
+  zstring temp;
+
+  SctxStaticallyKnownCollationsIteratorState *state;
+  DEFAULT_STACK_INIT( SctxStaticallyKnownCollationsIteratorState, state, plan_state );
+
+  theSctx->get_collations( state->coll_ );
+
+  for ( state->it_ = state->coll_.begin(); state->it_ != state->coll_.end();
+        ++state->it_ ) {
+    temp = *state->it_;
+    STACK_PUSH( GENV_ITEMFACTORY->createString( result, temp ), state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxStaticallyKnownDocumentsIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset(plan_state);
+  docs_.clear();
+}
+
+bool SctxStaticallyKnownDocumentsIterator::
+nextImpl( store::Item_t& result, PlanState &plan_state ) const {
+  zstring temp;
+
+  SctxStaticallyKnownDocumentsIteratorState *state;
+  DEFAULT_STACK_INIT( SctxStaticallyKnownDocumentsIteratorState, state, plan_state );
+
+  theSctx->get_all_documents( state->docs_ );
+
+  for ( state->it_ = state->docs_.begin(); state->it_ != state->docs_.end();
+        ++state->it_ ) {
+    temp = *state->it_;
+    GENV_ITEMFACTORY->createString( result, temp );
+    STACK_PUSH( true, state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxStaticallyKnownDocumentTypeIterator::
+nextImpl( store::Item_t &result, PlanState &plan_state ) const {
+  store::Item_t item;
+  zstring type_str;
+  xqtref_t type;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+  consumeNext( item, theChildren[0].getp(), plan_state );
+  type = theSctx->lookup_document( item->getStringValue() );
+  type_str = type.getp() ? type->toSchemaString() : "document-node()?";
+
+  GENV_ITEMFACTORY->createString( result, type_str );
+  STACK_PUSH( true, state );
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxStaticallyKnownNamespaceBindingIterator::
+nextImpl( store::Item_t& result, PlanState &plan_state ) const {
+  store::Item_t item;
+  zstring ns;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+  consumeNext( item, theChildren[0].getp(), plan_state );
+
+  if ( theSctx->lookup_ns( ns, item->getStringValue(), loc, false ) ) {
+    GENV_ITEMFACTORY->createString( result, ns );
+    STACK_PUSH( true, state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SctxStaticallyKnownNamespacesIteratorState::reset( PlanState &plan_state ) {
+  PlanIteratorState::reset( plan_state );
+  bindings_.clear();
+}
+
+bool SctxStaticallyKnownNamespacesIterator::
+nextImpl( store::Item_t& result, PlanState &plan_state ) const {
+  zstring prefix;
+
+  SctxStaticallyKnownNamespacesIteratorState *state;
+  DEFAULT_STACK_INIT( SctxStaticallyKnownNamespacesIteratorState, state, plan_state );
+
+  theSctx->get_namespace_bindings( state->bindings_ );
+
+  for ( state->it_ = state->bindings_.begin();
+        state->it_ != state->bindings_.end(); ++state->it_ ) {
+    prefix = (*state->it_).first;
+    GENV_ITEMFACTORY->createString( result, prefix );
+    STACK_PUSH( true, state );
+  }
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool SctxXPath10CompatModeIterator::nextImpl( store::Item_t &result,
+                                              PlanState &plan_state ) const {
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+  GENV_ITEMFACTORY->createBoolean(
+    result,
+    theSctx->xpath_compatibility() == StaticContextConsts::xpath1_0_only
+  );
+  STACK_PUSH( true, state );
+
+  STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml	2013-09-19 14:00:22 +0000
+++ src/runtime/spec/mappings.xml	2013-10-01 03:26:58 +0000
@@ -94,9 +94,9 @@
                      define="ZORBA_RANDOM_FN_NS" 
                      prefix="fn-zorba-random"/>
 
-    <zorba:namespace uri="http://www.zorba-xquery.com/modules/introspection/sctx";
-                     define="ZORBA_INTROSPECT_SCTX_FN_NS" 
-                     prefix="fn-zorba-introspect-sctx"/>
+    <zorba:namespace uri="http://zorba.io/modules/sctx";
+                     define="ZORBA_SCTX_FN_NS" 
+                     prefix="fn-zorba-sctx"/>
 
     <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection";
                      define="ZORBA_REFLECTION_FN_NS" 

=== renamed directory 'src/runtime/spec/introspection' => 'src/runtime/spec/sctx'
=== modified file 'src/runtime/spec/sctx/sctx.xml'
--- src/runtime/spec/introspection/sctx.xml	2013-02-07 17:24:36 +0000
+++ src/runtime/spec/sctx/sctx.xml	2013-10-01 03:26:58 +0000
@@ -1,10 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!--
-/////////////////////////////////////////////////////////////////////////////////
-//                                                                             //
-/////////////////////////////////////////////////////////////////////////////////
--->
 <zorba:iterators
   xmlns:zorba="http://www.zorba-xquery.com";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
@@ -18,543 +13,352 @@
   <zorba:include form="Quoted">store/api/iterator.h</zorba:include>
 </zorba:source>
 
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="StaticNamespacesIterator">
-    <zorba:description author="Zorba Team">
-      sc:statically-known-namespaces
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="statically-known-namespaces"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:output>xs:string*</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-
-    <zorba:state generateReset="false" generateDestructor="false">
-      <zorba:member type="store::NsBindings" name="theBindings"
-                    brief="vector of namespace bindings"/>
-      <zorba:member type="ulong" name="thePosition" brief="current position"/>
-    </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="DefaultFunctionNamespaceIterator">
-    <zorba:description author="Zorba Team">
-      sc:default-function-namespace
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="default-function-namespace"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:output>xs:string</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
+<!--========================================================================-->
+
 <zorba:iterator name="SctxBaseUriIterator">
-    <zorba:description author="Zorba Team">
-      sc:base-uri
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="base-uri"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:output>xs:string?</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
+  <zorba:function>
+    <zorba:signature localname="base-uri"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string?</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxBoundarySpacePolicyIterator">
+  <zorba:function>
+    <zorba:signature localname="boundary-space-policy"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxConstructionModeIterator">
+  <zorba:function>
+    <zorba:signature localname="construction-mode"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxCopyNamespacesModeIterator">
+  <zorba:function>
+    <zorba:signature localname="copy-namespaces-mode"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string+</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
 <zorba:iterator name="SctxDefaultCollationIterator">
-    <zorba:description author="Zorba Team">
-      sc:default-collation
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="default-collation"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:output>xs:string</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="StaticNamespaceBindingIterator">
-    <zorba:description author="Zorba Team">
-      sc:statically-known-namespace-binding
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="statically-known-namespace-binding"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:param>xs:string</zorba:param>
-        <zorba:output>xs:string?</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="InscopeVariablesIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:in-scope-variables
-  </zorba:description>
-
   <zorba:function>
-    <zorba:signature localname="in-scope-variables"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:QName*</zorba:output>
+    <zorba:signature localname="default-collation"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
     </zorba:signature>
   </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="std::vector&lt;VarInfo*&gt;" name="theVariables"
-                  brief="vector of variables"/>
-    <zorba:member type="csize" name="thePosition" brief="current position"/>
-  </zorba:state>
-
 </zorba:iterator>
 
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="DefaultCollectionTypeIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:default-collection-type
-  </zorba:description>
-
+<!--========================================================================-->
+
+<zorba:iterator name="SctxDefaultCollectionTypeIterator">
   <zorba:function>
     <zorba:signature localname="default-collection-type"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:string</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="XPath10CompatModeIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:xpath10-compatibility-mode
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="xpath10-compatibility-mode"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:boolean</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="StaticallyKnownDocumentsIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:statically-known-documents
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="statically-known-documents"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:anyURI*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="std::vector &lt; zstring &gt;" name="theDocuments"
-                  brief="vector of document URIs"/>
-    <zorba:member type="ulong" name="thePosition" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="StaticallyKnownDocumentTypeIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:statically-known-document-type
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="statically-known-document-type"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:param>xs:string</zorba:param>
-      <zorba:output>xs:QName</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="StaticallyKnownCollationsIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:statically-known-collations
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="statically-known-collations"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:anyURI*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="std::vector &lt; std::string &gt;" name="theCollations"
-                  brief="vector of collation uris"/>
-    <zorba:member type="ulong" name="thePosition" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="ConstructionModeIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:construction-mode
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="construction-mode"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:string</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="OrderingModeIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:ordering-mode
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="ordering-mode"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:string</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="DefaultOrderIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:default-order
-  </zorba:description>
-
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxDefaultFunctionNamespaceIterator">
+  <zorba:function>
+    <zorba:signature localname="default-function-namespace"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxDefaultOrderIterator">
   <zorba:function>
     <zorba:signature localname="default-order"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:string</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="BoundarySpacePolicyIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:boundary-space-policy
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="boundary-space-policy"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:string</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="CopyNamespacesModeIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:copy-namespaces-mode
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="copy-namespaces-mode"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:string+</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="FunctionNamesIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:function-names
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="function-names"
-                     prefix="fn-zorba-introspect-sctx">
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxFunctionAnnotationsIterator">
+  <zorba:function>
+    <zorba:signature localname="function-annotations"
+                     prefix="fn-zorba-sctx">
+      <zorba:param>xs:QName</zorba:param>
+      <zorba:param>xs:integer</zorba:param>
       <zorba:output>xs:QName*</zorba:output>
     </zorba:signature>
   </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="std::vector &lt; function *&gt;" name="theFunctions"
-                  brief="vector of functions"/>
-    <zorba:member type="ulong" name="thePosition" brief="current position"/>
+  <zorba:state generateReset="false">
+    <zorba:member type="const function*" name="theFunction"/>
+    <zorba:member type="unsigned long" name="thePosition"/>
   </zorba:state>
-
 </zorba:iterator>
 
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="FunctionArgumentsCountIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:function-arguments-count
-  </zorba:description>
-
+<!--========================================================================-->
+
+<zorba:iterator name="SctxFunctionArgumentsCountIterator">
   <zorba:function>
     <zorba:signature localname="function-arguments-count"
-                     prefix="fn-zorba-introspect-sctx">
+                     prefix="fn-zorba-sctx">
       <zorba:param>xs:QName</zorba:param>
       <zorba:output>xs:int*</zorba:output>
     </zorba:signature>
   </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="std::vector &lt; int &gt;" name="arities"
-                  brief="vector of arities"/>
-    <zorba:member type="unsigned int" name="position" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="InScopeSchemaTypesIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:in-scope-schema-types
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="in-scope-schema-types"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:QName*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="unsigned int" name="ns_pos" brief="current position"/>
-    <zorba:member type="unsigned int" name="elem_pos" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="InScopeElementDeclarationsIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:in-scope-element-declarations
-  </zorba:description>
-
+  <zorba:state generateReset="false">
+    <zorba:member type="std::vector&lt;int&gt;" name="arities_"/>
+    <zorba:member type="std::vector&lt;int&gt;::const_iterator" name="it_"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxFunctionNamesIterator">
+  <zorba:function>
+    <zorba:signature localname="function-names"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="std::vector&lt;function*&gt;" name="theFunctions"/>
+    <zorba:member type="unsigned long" name="thePosition"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxFunctionsIterator">
+  <zorba:function>
+    <zorba:signature localname="functions"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>object()*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="std::vector&lt;function*&gt;" name="funcs_"/>
+    <zorba:member type="std::vector&lt;function*&gt;::const_iterator" name="it_"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxInScopeAttributeDeclarationsIterator">
+  <zorba:function>
+    <zorba:signature localname="in-scope-attribute-declarations"
+                      prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="unsigned" name="ns_pos"/>
+    <zorba:member type="unsigned" name="elem_pos"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxInScopeAttributeGroupsIterator">
+  <zorba:function>
+    <zorba:signature localname="in-scope-attribute-groups"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="unsigned" name="ns_pos"/>
+    <zorba:member type="unsigned" name="elem_pos"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxInScopeElementDeclarationsIterator">
   <zorba:function>
     <zorba:signature localname="in-scope-element-declarations"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:QName*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="unsigned int" name="ns_pos" brief="current position"/>
-    <zorba:member type="unsigned int" name="elem_pos" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="InScopeAttributeDeclarationsIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:in-scope-attribute-declarations
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="in-scope-attribute-declarations"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:QName*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="unsigned int" name="ns_pos" brief="current position"/>
-    <zorba:member type="unsigned int" name="elem_pos" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="InScopeElementGroupsIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:in-scope-schema-types
-  </zorba:description>
-
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="unsigned" name="ns_pos"/>
+    <zorba:member type="unsigned" name="elem_pos"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxInScopeElementGroupsIterator">
   <zorba:function>
     <zorba:signature localname="in-scope-element-groups"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:QName*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="unsigned int" name="ns_pos" brief="current position"/>
-    <zorba:member type="unsigned int" name="elem_pos" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="InScopeAttributeGroupsIterator">
-
-  <zorba:description author="Zorba Team">
-    sc:in-scope-schema-types
-  </zorba:description>
-
-  <zorba:function>
-    <zorba:signature localname="in-scope-attribute-groups"
-                     prefix="fn-zorba-introspect-sctx">
-      <zorba:output>xs:QName*</zorba:output>
-    </zorba:signature>
-  </zorba:function>
-
-  <zorba:state generateReset="false" generateDestructor="false">
-    <zorba:member type="unsigned int" name="ns_pos" brief="current position"/>
-    <zorba:member type="unsigned int" name="elem_pos" brief="current position"/>
-  </zorba:state>
-
-</zorba:iterator>
-
-
-<!--
-/*******************************************************************************
-*******************************************************************************/
--->
-<zorba:iterator name="OptionIterator">
-
-    <zorba:description author="Zorba Team">
-      sc:option
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="option"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:output>xs:string?</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-*******************************************************************************/
--->
-<zorba:iterator name="FunctionAnnotationsIterator">
-
-    <zorba:description author="Zorba Team">
-      sc:option
-    </zorba:description>
-
-    <zorba:function>
-      <zorba:signature localname="function-annotations"
-                       prefix="fn-zorba-introspect-sctx">
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:param>xs:integer</zorba:param>
-        <zorba:output>xs:QName*</zorba:output>
-      </zorba:signature>
-    </zorba:function>
-
-    <zorba:state generateReset="false" generateDestructor="false">
-      <zorba:member type="const function*" name="theFunction"
-                  brief="the function"/>
-      <zorba:member type="ulong" name="thePosition" brief="current position"/>
-    </zorba:state>
-
-</zorba:iterator>
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="unsigned" name="ns_pos"/>
+    <zorba:member type="unsigned" name="elem_pos"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxInScopeSchemaTypesIterator">
+  <zorba:function>
+    <zorba:signature localname="in-scope-schema-types"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="unsigned" name="ns_pos"/>
+    <zorba:member type="unsigned" name="elem_pos"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxInscopeVariablesIterator">
+  <zorba:function>
+    <zorba:signature localname="in-scope-variables"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:QName*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="std::vector&lt;VarInfo*&gt;" name="vars_"/>
+    <zorba:member type="std::vector&lt;VarInfo*&gt;::const_iterator" name="it_"/>
+    <zorba:member type="csize" name="thePosition"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxOptionIterator">
+  <zorba:function>
+    <zorba:signature localname="option"
+                     prefix="fn-zorba-sctx">
+      <zorba:param>xs:QName</zorba:param>
+      <zorba:output>xs:string?</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxOrderingModeIterator">
+  <zorba:function>
+    <zorba:signature localname="ordering-mode"
+                      prefix="fn-zorba-sctx">
+      <zorba:output>xs:string</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxStaticallyKnownCollationsIterator">
+  <zorba:function>
+    <zorba:signature localname="statically-known-collations"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:anyURI*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="std::vector&lt;std::string&gt;" name="coll_"/>
+    <zorba:member type="std::vector&lt;std::string&gt;::const_iterator" name="it_"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxStaticallyKnownDocumentsIterator">
+  <zorba:function>
+    <zorba:signature localname="statically-known-documents"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:anyURI*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="std::vector&lt;zstring&gt;" name="docs_"/>
+    <zorba:member type="std::vector&lt;zstring&gt;::const_iterator" name="it_"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxStaticallyKnownDocumentTypeIterator">
+  <zorba:function>
+    <zorba:signature localname="statically-known-document-type"
+                     prefix="fn-zorba-sctx">
+      <zorba:param>xs:string</zorba:param>
+      <zorba:output>xs:QName</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxStaticallyKnownNamespaceBindingIterator">
+  <zorba:function>
+    <zorba:signature localname="statically-known-namespace-binding"
+                     prefix="fn-zorba-sctx">
+      <zorba:param>xs:string</zorba:param>
+      <zorba:output>xs:string?</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxStaticallyKnownNamespacesIterator">
+  <zorba:function>
+    <zorba:signature localname="statically-known-namespaces"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:string*</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+  <zorba:state generateReset="false">
+    <zorba:member type="store::NsBindings" name="bindings_"/>
+    <zorba:member type="store::NsBindings::const_iterator" name="it_"/>
+  </zorba:state>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+<zorba:iterator name="SctxXPath10CompatModeIterator">
+  <zorba:function>
+    <zorba:signature localname="xpath10-compatibility-mode"
+                     prefix="fn-zorba-sctx">
+      <zorba:output>xs:boolean</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
 
 </zorba:iterators>
+<!-- vim:set et sw=2 ts=2: -->

=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h	2013-09-19 16:09:35 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h	2013-10-01 03:26:58 +0000
@@ -282,56 +282,6 @@
 
     class IndexKeysIterator;
 
-    class StaticNamespacesIterator;
-
-    class DefaultFunctionNamespaceIterator;
-
-    class SctxBaseUriIterator;
-
-    class SctxDefaultCollationIterator;
-
-    class StaticNamespaceBindingIterator;
-
-    class InscopeVariablesIterator;
-
-    class DefaultCollectionTypeIterator;
-
-    class XPath10CompatModeIterator;
-
-    class StaticallyKnownDocumentsIterator;
-
-    class StaticallyKnownDocumentTypeIterator;
-
-    class StaticallyKnownCollationsIterator;
-
-    class ConstructionModeIterator;
-
-    class OrderingModeIterator;
-
-    class DefaultOrderIterator;
-
-    class BoundarySpacePolicyIterator;
-
-    class CopyNamespacesModeIterator;
-
-    class FunctionNamesIterator;
-
-    class FunctionArgumentsCountIterator;
-
-    class InScopeSchemaTypesIterator;
-
-    class InScopeElementDeclarationsIterator;
-
-    class InScopeAttributeDeclarationsIterator;
-
-    class InScopeElementGroupsIterator;
-
-    class InScopeAttributeGroupsIterator;
-
-    class OptionIterator;
-
-    class FunctionAnnotationsIterator;
-
     class MemSizeIterator;
 
     class JSONtoXMLInternal;
@@ -585,6 +535,58 @@
 
     class ZorbaIsValidatedIterator;
 
+    class SctxBaseUriIterator;
+
+    class SctxBoundarySpacePolicyIterator;
+
+    class SctxConstructionModeIterator;
+
+    class SctxCopyNamespacesModeIterator;
+
+    class SctxDefaultCollationIterator;
+
+    class SctxDefaultCollectionTypeIterator;
+
+    class SctxDefaultFunctionNamespaceIterator;
+
+    class SctxDefaultOrderIterator;
+
+    class SctxFunctionAnnotationsIterator;
+
+    class SctxFunctionArgumentsCountIterator;
+
+    class SctxFunctionNamesIterator;
+
+    class SctxFunctionsIterator;
+
+    class SctxInScopeAttributeDeclarationsIterator;
+
+    class SctxInScopeAttributeGroupsIterator;
+
+    class SctxInScopeElementDeclarationsIterator;
+
+    class SctxInScopeElementGroupsIterator;
+
+    class SctxInScopeSchemaTypesIterator;
+
+    class SctxInscopeVariablesIterator;
+
+    class SctxOptionIterator;
+
+    class SctxOrderingModeIterator;
+
+    class SctxStaticallyKnownCollationsIterator;
+
+    class SctxStaticallyKnownDocumentsIterator;
+
+    class SctxStaticallyKnownDocumentTypeIterator;
+
+    class SctxStaticallyKnownNamespaceBindingIterator;
+
+    class SctxStaticallyKnownNamespacesIterator;
+
+    class SctxXPath10CompatModeIterator;
+
     class FnConcatIterator;
 
     class FnIndexOfIterator;
@@ -1133,81 +1135,6 @@
     virtual void beginVisit ( const IndexKeysIterator& ) = 0;
     virtual void endVisit   ( const IndexKeysIterator& ) = 0;
 
-    virtual void beginVisit ( const StaticNamespacesIterator& ) = 0;
-    virtual void endVisit   ( const StaticNamespacesIterator& ) = 0;
-
-    virtual void beginVisit ( const DefaultFunctionNamespaceIterator& ) = 0;
-    virtual void endVisit   ( const DefaultFunctionNamespaceIterator& ) = 0;
-
-    virtual void beginVisit ( const SctxBaseUriIterator& ) = 0;
-    virtual void endVisit   ( const SctxBaseUriIterator& ) = 0;
-
-    virtual void beginVisit ( const SctxDefaultCollationIterator& ) = 0;
-    virtual void endVisit   ( const SctxDefaultCollationIterator& ) = 0;
-
-    virtual void beginVisit ( const StaticNamespaceBindingIterator& ) = 0;
-    virtual void endVisit   ( const StaticNamespaceBindingIterator& ) = 0;
-
-    virtual void beginVisit ( const InscopeVariablesIterator& ) = 0;
-    virtual void endVisit   ( const InscopeVariablesIterator& ) = 0;
-
-    virtual void beginVisit ( const DefaultCollectionTypeIterator& ) = 0;
-    virtual void endVisit   ( const DefaultCollectionTypeIterator& ) = 0;
-
-    virtual void beginVisit ( const XPath10CompatModeIterator& ) = 0;
-    virtual void endVisit   ( const XPath10CompatModeIterator& ) = 0;
-
-    virtual void beginVisit ( const StaticallyKnownDocumentsIterator& ) = 0;
-    virtual void endVisit   ( const StaticallyKnownDocumentsIterator& ) = 0;
-
-    virtual void beginVisit ( const StaticallyKnownDocumentTypeIterator& ) = 0;
-    virtual void endVisit   ( const StaticallyKnownDocumentTypeIterator& ) = 0;
-
-    virtual void beginVisit ( const StaticallyKnownCollationsIterator& ) = 0;
-    virtual void endVisit   ( const StaticallyKnownCollationsIterator& ) = 0;
-
-    virtual void beginVisit ( const ConstructionModeIterator& ) = 0;
-    virtual void endVisit   ( const ConstructionModeIterator& ) = 0;
-
-    virtual void beginVisit ( const OrderingModeIterator& ) = 0;
-    virtual void endVisit   ( const OrderingModeIterator& ) = 0;
-
-    virtual void beginVisit ( const DefaultOrderIterator& ) = 0;
-    virtual void endVisit   ( const DefaultOrderIterator& ) = 0;
-
-    virtual void beginVisit ( const BoundarySpacePolicyIterator& ) = 0;
-    virtual void endVisit   ( const BoundarySpacePolicyIterator& ) = 0;
-
-    virtual void beginVisit ( const CopyNamespacesModeIterator& ) = 0;
-    virtual void endVisit   ( const CopyNamespacesModeIterator& ) = 0;
-
-    virtual void beginVisit ( const FunctionNamesIterator& ) = 0;
-    virtual void endVisit   ( const FunctionNamesIterator& ) = 0;
-
-    virtual void beginVisit ( const FunctionArgumentsCountIterator& ) = 0;
-    virtual void endVisit   ( const FunctionArgumentsCountIterator& ) = 0;
-
-    virtual void beginVisit ( const InScopeSchemaTypesIterator& ) = 0;
-    virtual void endVisit   ( const InScopeSchemaTypesIterator& ) = 0;
-
-    virtual void beginVisit ( const InScopeElementDeclarationsIterator& ) = 0;
-    virtual void endVisit   ( const InScopeElementDeclarationsIterator& ) = 0;
-
-    virtual void beginVisit ( const InScopeAttributeDeclarationsIterator& ) = 0;
-    virtual void endVisit   ( const InScopeAttributeDeclarationsIterator& ) = 0;
-
-    virtual void beginVisit ( const InScopeElementGroupsIterator& ) = 0;
-    virtual void endVisit   ( const InScopeElementGroupsIterator& ) = 0;
-
-    virtual void beginVisit ( const InScopeAttributeGroupsIterator& ) = 0;
-    virtual void endVisit   ( const InScopeAttributeGroupsIterator& ) = 0;
-
-    virtual void beginVisit ( const OptionIterator& ) = 0;
-    virtual void endVisit   ( const OptionIterator& ) = 0;
-
-    virtual void beginVisit ( const FunctionAnnotationsIterator& ) = 0;
-    virtual void endVisit   ( const FunctionAnnotationsIterator& ) = 0;
-
     virtual void beginVisit ( const MemSizeIterator& ) = 0;
     virtual void endVisit   ( const MemSizeIterator& ) = 0;
 
@@ -1587,6 +1514,84 @@
     virtual void beginVisit ( const ZorbaIsValidatedIterator& ) = 0;
     virtual void endVisit   ( const ZorbaIsValidatedIterator& ) = 0;
 
+    virtual void beginVisit ( const SctxBaseUriIterator& ) = 0;
+    virtual void endVisit   ( const SctxBaseUriIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxBoundarySpacePolicyIterator& ) = 0;
+    virtual void endVisit   ( const SctxBoundarySpacePolicyIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxConstructionModeIterator& ) = 0;
+    virtual void endVisit   ( const SctxConstructionModeIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxCopyNamespacesModeIterator& ) = 0;
+    virtual void endVisit   ( const SctxCopyNamespacesModeIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxDefaultCollationIterator& ) = 0;
+    virtual void endVisit   ( const SctxDefaultCollationIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxDefaultCollectionTypeIterator& ) = 0;
+    virtual void endVisit   ( const SctxDefaultCollectionTypeIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxDefaultFunctionNamespaceIterator& ) = 0;
+    virtual void endVisit   ( const SctxDefaultFunctionNamespaceIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxDefaultOrderIterator& ) = 0;
+    virtual void endVisit   ( const SctxDefaultOrderIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxFunctionAnnotationsIterator& ) = 0;
+    virtual void endVisit   ( const SctxFunctionAnnotationsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxFunctionArgumentsCountIterator& ) = 0;
+    virtual void endVisit   ( const SctxFunctionArgumentsCountIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxFunctionNamesIterator& ) = 0;
+    virtual void endVisit   ( const SctxFunctionNamesIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxFunctionsIterator& ) = 0;
+    virtual void endVisit   ( const SctxFunctionsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxInScopeAttributeDeclarationsIterator& ) = 0;
+    virtual void endVisit   ( const SctxInScopeAttributeDeclarationsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxInScopeAttributeGroupsIterator& ) = 0;
+    virtual void endVisit   ( const SctxInScopeAttributeGroupsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxInScopeElementDeclarationsIterator& ) = 0;
+    virtual void endVisit   ( const SctxInScopeElementDeclarationsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxInScopeElementGroupsIterator& ) = 0;
+    virtual void endVisit   ( const SctxInScopeElementGroupsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxInScopeSchemaTypesIterator& ) = 0;
+    virtual void endVisit   ( const SctxInScopeSchemaTypesIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxInscopeVariablesIterator& ) = 0;
+    virtual void endVisit   ( const SctxInscopeVariablesIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxOptionIterator& ) = 0;
+    virtual void endVisit   ( const SctxOptionIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxOrderingModeIterator& ) = 0;
+    virtual void endVisit   ( const SctxOrderingModeIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxStaticallyKnownCollationsIterator& ) = 0;
+    virtual void endVisit   ( const SctxStaticallyKnownCollationsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxStaticallyKnownDocumentsIterator& ) = 0;
+    virtual void endVisit   ( const SctxStaticallyKnownDocumentsIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxStaticallyKnownDocumentTypeIterator& ) = 0;
+    virtual void endVisit   ( const SctxStaticallyKnownDocumentTypeIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxStaticallyKnownNamespaceBindingIterator& ) = 0;
+    virtual void endVisit   ( const SctxStaticallyKnownNamespaceBindingIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxStaticallyKnownNamespacesIterator& ) = 0;
+    virtual void endVisit   ( const SctxStaticallyKnownNamespacesIterator& ) = 0;
+
+    virtual void beginVisit ( const SctxXPath10CompatModeIterator& ) = 0;
+    virtual void endVisit   ( const SctxXPath10CompatModeIterator& ) = 0;
+
     virtual void beginVisit ( const FnConcatIterator& ) = 0;
     virtual void endVisit   ( const FnConcatIterator& ) = 0;
 

=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp	2013-09-19 16:09:35 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp	2013-10-01 03:26:58 +0000
@@ -53,7 +53,6 @@
 #include "runtime/hof/fn_hof_functions.h"
 #include "runtime/indexing/ic_ddl.h"
 #include "runtime/indexing/index_func.h"
-#include "runtime/introspection/sctx.h"
 #include "runtime/item/item.h"
 #include "runtime/json/json.h"
 #include "runtime/json/jsoniq_functions.h"
@@ -67,6 +66,7 @@
 #include "runtime/random/random.h"
 #include "runtime/reference/reference.h"
 #include "runtime/schema/schema.h"
+#include "runtime/sctx/sctx.h"
 #include "runtime/sequences/sequences.h"
 #include "runtime/store/documents.h"
 #include "runtime/store/maps.h"
@@ -1647,356 +1647,6 @@
 // </IndexKeysIterator>
 
 
-// <StaticNamespacesIterator>
-void PrinterVisitor::beginVisit ( const StaticNamespacesIterator& a) {
-  thePrinter.startBeginVisit("StaticNamespacesIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const StaticNamespacesIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </StaticNamespacesIterator>
-
-
-// <DefaultFunctionNamespaceIterator>
-void PrinterVisitor::beginVisit ( const DefaultFunctionNamespaceIterator& a) {
-  thePrinter.startBeginVisit("DefaultFunctionNamespaceIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const DefaultFunctionNamespaceIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </DefaultFunctionNamespaceIterator>
-
-
-// <SctxBaseUriIterator>
-void PrinterVisitor::beginVisit ( const SctxBaseUriIterator& a) {
-  thePrinter.startBeginVisit("SctxBaseUriIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const SctxBaseUriIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </SctxBaseUriIterator>
-
-
-// <SctxDefaultCollationIterator>
-void PrinterVisitor::beginVisit ( const SctxDefaultCollationIterator& a) {
-  thePrinter.startBeginVisit("SctxDefaultCollationIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const SctxDefaultCollationIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </SctxDefaultCollationIterator>
-
-
-// <StaticNamespaceBindingIterator>
-void PrinterVisitor::beginVisit ( const StaticNamespaceBindingIterator& a) {
-  thePrinter.startBeginVisit("StaticNamespaceBindingIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const StaticNamespaceBindingIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </StaticNamespaceBindingIterator>
-
-
-// <InscopeVariablesIterator>
-void PrinterVisitor::beginVisit ( const InscopeVariablesIterator& a) {
-  thePrinter.startBeginVisit("InscopeVariablesIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const InscopeVariablesIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </InscopeVariablesIterator>
-
-
-// <DefaultCollectionTypeIterator>
-void PrinterVisitor::beginVisit ( const DefaultCollectionTypeIterator& a) {
-  thePrinter.startBeginVisit("DefaultCollectionTypeIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const DefaultCollectionTypeIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </DefaultCollectionTypeIterator>
-
-
-// <XPath10CompatModeIterator>
-void PrinterVisitor::beginVisit ( const XPath10CompatModeIterator& a) {
-  thePrinter.startBeginVisit("XPath10CompatModeIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const XPath10CompatModeIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </XPath10CompatModeIterator>
-
-
-// <StaticallyKnownDocumentsIterator>
-void PrinterVisitor::beginVisit ( const StaticallyKnownDocumentsIterator& a) {
-  thePrinter.startBeginVisit("StaticallyKnownDocumentsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const StaticallyKnownDocumentsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </StaticallyKnownDocumentsIterator>
-
-
-// <StaticallyKnownDocumentTypeIterator>
-void PrinterVisitor::beginVisit ( const StaticallyKnownDocumentTypeIterator& a) {
-  thePrinter.startBeginVisit("StaticallyKnownDocumentTypeIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const StaticallyKnownDocumentTypeIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </StaticallyKnownDocumentTypeIterator>
-
-
-// <StaticallyKnownCollationsIterator>
-void PrinterVisitor::beginVisit ( const StaticallyKnownCollationsIterator& a) {
-  thePrinter.startBeginVisit("StaticallyKnownCollationsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const StaticallyKnownCollationsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </StaticallyKnownCollationsIterator>
-
-
-// <ConstructionModeIterator>
-void PrinterVisitor::beginVisit ( const ConstructionModeIterator& a) {
-  thePrinter.startBeginVisit("ConstructionModeIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const ConstructionModeIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </ConstructionModeIterator>
-
-
-// <OrderingModeIterator>
-void PrinterVisitor::beginVisit ( const OrderingModeIterator& a) {
-  thePrinter.startBeginVisit("OrderingModeIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const OrderingModeIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </OrderingModeIterator>
-
-
-// <DefaultOrderIterator>
-void PrinterVisitor::beginVisit ( const DefaultOrderIterator& a) {
-  thePrinter.startBeginVisit("DefaultOrderIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const DefaultOrderIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </DefaultOrderIterator>
-
-
-// <BoundarySpacePolicyIterator>
-void PrinterVisitor::beginVisit ( const BoundarySpacePolicyIterator& a) {
-  thePrinter.startBeginVisit("BoundarySpacePolicyIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const BoundarySpacePolicyIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </BoundarySpacePolicyIterator>
-
-
-// <CopyNamespacesModeIterator>
-void PrinterVisitor::beginVisit ( const CopyNamespacesModeIterator& a) {
-  thePrinter.startBeginVisit("CopyNamespacesModeIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const CopyNamespacesModeIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </CopyNamespacesModeIterator>
-
-
-// <FunctionNamesIterator>
-void PrinterVisitor::beginVisit ( const FunctionNamesIterator& a) {
-  thePrinter.startBeginVisit("FunctionNamesIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const FunctionNamesIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </FunctionNamesIterator>
-
-
-// <FunctionArgumentsCountIterator>
-void PrinterVisitor::beginVisit ( const FunctionArgumentsCountIterator& a) {
-  thePrinter.startBeginVisit("FunctionArgumentsCountIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const FunctionArgumentsCountIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </FunctionArgumentsCountIterator>
-
-
-// <InScopeSchemaTypesIterator>
-void PrinterVisitor::beginVisit ( const InScopeSchemaTypesIterator& a) {
-  thePrinter.startBeginVisit("InScopeSchemaTypesIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const InScopeSchemaTypesIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </InScopeSchemaTypesIterator>
-
-
-// <InScopeElementDeclarationsIterator>
-void PrinterVisitor::beginVisit ( const InScopeElementDeclarationsIterator& a) {
-  thePrinter.startBeginVisit("InScopeElementDeclarationsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const InScopeElementDeclarationsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </InScopeElementDeclarationsIterator>
-
-
-// <InScopeAttributeDeclarationsIterator>
-void PrinterVisitor::beginVisit ( const InScopeAttributeDeclarationsIterator& a) {
-  thePrinter.startBeginVisit("InScopeAttributeDeclarationsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const InScopeAttributeDeclarationsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </InScopeAttributeDeclarationsIterator>
-
-
-// <InScopeElementGroupsIterator>
-void PrinterVisitor::beginVisit ( const InScopeElementGroupsIterator& a) {
-  thePrinter.startBeginVisit("InScopeElementGroupsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const InScopeElementGroupsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </InScopeElementGroupsIterator>
-
-
-// <InScopeAttributeGroupsIterator>
-void PrinterVisitor::beginVisit ( const InScopeAttributeGroupsIterator& a) {
-  thePrinter.startBeginVisit("InScopeAttributeGroupsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const InScopeAttributeGroupsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </InScopeAttributeGroupsIterator>
-
-
-// <OptionIterator>
-void PrinterVisitor::beginVisit ( const OptionIterator& a) {
-  thePrinter.startBeginVisit("OptionIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const OptionIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </OptionIterator>
-
-
-// <FunctionAnnotationsIterator>
-void PrinterVisitor::beginVisit ( const FunctionAnnotationsIterator& a) {
-  thePrinter.startBeginVisit("FunctionAnnotationsIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const FunctionAnnotationsIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </FunctionAnnotationsIterator>
-
-
 // <MemSizeIterator>
 void PrinterVisitor::beginVisit ( const MemSizeIterator& a) {
   thePrinter.startBeginVisit("MemSizeIterator", ++theId);
@@ -3762,6 +3412,370 @@
 // </ZorbaIsValidatedIterator>
 
 
+// <SctxBaseUriIterator>
+void PrinterVisitor::beginVisit ( const SctxBaseUriIterator& a) {
+  thePrinter.startBeginVisit("SctxBaseUriIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxBaseUriIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxBaseUriIterator>
+
+
+// <SctxBoundarySpacePolicyIterator>
+void PrinterVisitor::beginVisit ( const SctxBoundarySpacePolicyIterator& a) {
+  thePrinter.startBeginVisit("SctxBoundarySpacePolicyIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxBoundarySpacePolicyIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxBoundarySpacePolicyIterator>
+
+
+// <SctxConstructionModeIterator>
+void PrinterVisitor::beginVisit ( const SctxConstructionModeIterator& a) {
+  thePrinter.startBeginVisit("SctxConstructionModeIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxConstructionModeIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxConstructionModeIterator>
+
+
+// <SctxCopyNamespacesModeIterator>
+void PrinterVisitor::beginVisit ( const SctxCopyNamespacesModeIterator& a) {
+  thePrinter.startBeginVisit("SctxCopyNamespacesModeIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxCopyNamespacesModeIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxCopyNamespacesModeIterator>
+
+
+// <SctxDefaultCollationIterator>
+void PrinterVisitor::beginVisit ( const SctxDefaultCollationIterator& a) {
+  thePrinter.startBeginVisit("SctxDefaultCollationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxDefaultCollationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxDefaultCollationIterator>
+
+
+// <SctxDefaultCollectionTypeIterator>
+void PrinterVisitor::beginVisit ( const SctxDefaultCollectionTypeIterator& a) {
+  thePrinter.startBeginVisit("SctxDefaultCollectionTypeIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxDefaultCollectionTypeIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxDefaultCollectionTypeIterator>
+
+
+// <SctxDefaultFunctionNamespaceIterator>
+void PrinterVisitor::beginVisit ( const SctxDefaultFunctionNamespaceIterator& a) {
+  thePrinter.startBeginVisit("SctxDefaultFunctionNamespaceIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxDefaultFunctionNamespaceIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxDefaultFunctionNamespaceIterator>
+
+
+// <SctxDefaultOrderIterator>
+void PrinterVisitor::beginVisit ( const SctxDefaultOrderIterator& a) {
+  thePrinter.startBeginVisit("SctxDefaultOrderIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxDefaultOrderIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxDefaultOrderIterator>
+
+
+// <SctxFunctionAnnotationsIterator>
+void PrinterVisitor::beginVisit ( const SctxFunctionAnnotationsIterator& a) {
+  thePrinter.startBeginVisit("SctxFunctionAnnotationsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxFunctionAnnotationsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxFunctionAnnotationsIterator>
+
+
+// <SctxFunctionArgumentsCountIterator>
+void PrinterVisitor::beginVisit ( const SctxFunctionArgumentsCountIterator& a) {
+  thePrinter.startBeginVisit("SctxFunctionArgumentsCountIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxFunctionArgumentsCountIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxFunctionArgumentsCountIterator>
+
+
+// <SctxFunctionNamesIterator>
+void PrinterVisitor::beginVisit ( const SctxFunctionNamesIterator& a) {
+  thePrinter.startBeginVisit("SctxFunctionNamesIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxFunctionNamesIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxFunctionNamesIterator>
+
+
+// <SctxFunctionsIterator>
+void PrinterVisitor::beginVisit ( const SctxFunctionsIterator& a) {
+  thePrinter.startBeginVisit("SctxFunctionsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxFunctionsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxFunctionsIterator>
+
+
+// <SctxInScopeAttributeDeclarationsIterator>
+void PrinterVisitor::beginVisit ( const SctxInScopeAttributeDeclarationsIterator& a) {
+  thePrinter.startBeginVisit("SctxInScopeAttributeDeclarationsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxInScopeAttributeDeclarationsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxInScopeAttributeDeclarationsIterator>
+
+
+// <SctxInScopeAttributeGroupsIterator>
+void PrinterVisitor::beginVisit ( const SctxInScopeAttributeGroupsIterator& a) {
+  thePrinter.startBeginVisit("SctxInScopeAttributeGroupsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxInScopeAttributeGroupsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxInScopeAttributeGroupsIterator>
+
+
+// <SctxInScopeElementDeclarationsIterator>
+void PrinterVisitor::beginVisit ( const SctxInScopeElementDeclarationsIterator& a) {
+  thePrinter.startBeginVisit("SctxInScopeElementDeclarationsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxInScopeElementDeclarationsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxInScopeElementDeclarationsIterator>
+
+
+// <SctxInScopeElementGroupsIterator>
+void PrinterVisitor::beginVisit ( const SctxInScopeElementGroupsIterator& a) {
+  thePrinter.startBeginVisit("SctxInScopeElementGroupsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxInScopeElementGroupsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxInScopeElementGroupsIterator>
+
+
+// <SctxInScopeSchemaTypesIterator>
+void PrinterVisitor::beginVisit ( const SctxInScopeSchemaTypesIterator& a) {
+  thePrinter.startBeginVisit("SctxInScopeSchemaTypesIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxInScopeSchemaTypesIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxInScopeSchemaTypesIterator>
+
+
+// <SctxInscopeVariablesIterator>
+void PrinterVisitor::beginVisit ( const SctxInscopeVariablesIterator& a) {
+  thePrinter.startBeginVisit("SctxInscopeVariablesIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxInscopeVariablesIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxInscopeVariablesIterator>
+
+
+// <SctxOptionIterator>
+void PrinterVisitor::beginVisit ( const SctxOptionIterator& a) {
+  thePrinter.startBeginVisit("SctxOptionIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxOptionIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxOptionIterator>
+
+
+// <SctxOrderingModeIterator>
+void PrinterVisitor::beginVisit ( const SctxOrderingModeIterator& a) {
+  thePrinter.startBeginVisit("SctxOrderingModeIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxOrderingModeIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxOrderingModeIterator>
+
+
+// <SctxStaticallyKnownCollationsIterator>
+void PrinterVisitor::beginVisit ( const SctxStaticallyKnownCollationsIterator& a) {
+  thePrinter.startBeginVisit("SctxStaticallyKnownCollationsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxStaticallyKnownCollationsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxStaticallyKnownCollationsIterator>
+
+
+// <SctxStaticallyKnownDocumentsIterator>
+void PrinterVisitor::beginVisit ( const SctxStaticallyKnownDocumentsIterator& a) {
+  thePrinter.startBeginVisit("SctxStaticallyKnownDocumentsIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxStaticallyKnownDocumentsIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxStaticallyKnownDocumentsIterator>
+
+
+// <SctxStaticallyKnownDocumentTypeIterator>
+void PrinterVisitor::beginVisit ( const SctxStaticallyKnownDocumentTypeIterator& a) {
+  thePrinter.startBeginVisit("SctxStaticallyKnownDocumentTypeIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxStaticallyKnownDocumentTypeIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxStaticallyKnownDocumentTypeIterator>
+
+
+// <SctxStaticallyKnownNamespaceBindingIterator>
+void PrinterVisitor::beginVisit ( const SctxStaticallyKnownNamespaceBindingIterator& a) {
+  thePrinter.startBeginVisit("SctxStaticallyKnownNamespaceBindingIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxStaticallyKnownNamespaceBindingIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxStaticallyKnownNamespaceBindingIterator>
+
+
+// <SctxStaticallyKnownNamespacesIterator>
+void PrinterVisitor::beginVisit ( const SctxStaticallyKnownNamespacesIterator& a) {
+  thePrinter.startBeginVisit("SctxStaticallyKnownNamespacesIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxStaticallyKnownNamespacesIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxStaticallyKnownNamespacesIterator>
+
+
+// <SctxXPath10CompatModeIterator>
+void PrinterVisitor::beginVisit ( const SctxXPath10CompatModeIterator& a) {
+  thePrinter.startBeginVisit("SctxXPath10CompatModeIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const SctxXPath10CompatModeIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </SctxXPath10CompatModeIterator>
+
+
 // <FnConcatIterator>
 void PrinterVisitor::beginVisit ( const FnConcatIterator& a) {
   thePrinter.startBeginVisit("FnConcatIterator", ++theId);

=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h	2013-09-19 16:09:35 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h	2013-10-01 03:26:58 +0000
@@ -433,81 +433,6 @@
     void beginVisit( const IndexKeysIterator& );
     void endVisit  ( const IndexKeysIterator& );
 
-    void beginVisit( const StaticNamespacesIterator& );
-    void endVisit  ( const StaticNamespacesIterator& );
-
-    void beginVisit( const DefaultFunctionNamespaceIterator& );
-    void endVisit  ( const DefaultFunctionNamespaceIterator& );
-
-    void beginVisit( const SctxBaseUriIterator& );
-    void endVisit  ( const SctxBaseUriIterator& );
-
-    void beginVisit( const SctxDefaultCollationIterator& );
-    void endVisit  ( const SctxDefaultCollationIterator& );
-
-    void beginVisit( const StaticNamespaceBindingIterator& );
-    void endVisit  ( const StaticNamespaceBindingIterator& );
-
-    void beginVisit( const InscopeVariablesIterator& );
-    void endVisit  ( const InscopeVariablesIterator& );
-
-    void beginVisit( const DefaultCollectionTypeIterator& );
-    void endVisit  ( const DefaultCollectionTypeIterator& );
-
-    void beginVisit( const XPath10CompatModeIterator& );
-    void endVisit  ( const XPath10CompatModeIterator& );
-
-    void beginVisit( const StaticallyKnownDocumentsIterator& );
-    void endVisit  ( const StaticallyKnownDocumentsIterator& );
-
-    void beginVisit( const StaticallyKnownDocumentTypeIterator& );
-    void endVisit  ( const StaticallyKnownDocumentTypeIterator& );
-
-    void beginVisit( const StaticallyKnownCollationsIterator& );
-    void endVisit  ( const StaticallyKnownCollationsIterator& );
-
-    void beginVisit( const ConstructionModeIterator& );
-    void endVisit  ( const ConstructionModeIterator& );
-
-    void beginVisit( const OrderingModeIterator& );
-    void endVisit  ( const OrderingModeIterator& );
-
-    void beginVisit( const DefaultOrderIterator& );
-    void endVisit  ( const DefaultOrderIterator& );
-
-    void beginVisit( const BoundarySpacePolicyIterator& );
-    void endVisit  ( const BoundarySpacePolicyIterator& );
-
-    void beginVisit( const CopyNamespacesModeIterator& );
-    void endVisit  ( const CopyNamespacesModeIterator& );
-
-    void beginVisit( const FunctionNamesIterator& );
-    void endVisit  ( const FunctionNamesIterator& );
-
-    void beginVisit( const FunctionArgumentsCountIterator& );
-    void endVisit  ( const FunctionArgumentsCountIterator& );
-
-    void beginVisit( const InScopeSchemaTypesIterator& );
-    void endVisit  ( const InScopeSchemaTypesIterator& );
-
-    void beginVisit( const InScopeElementDeclarationsIterator& );
-    void endVisit  ( const InScopeElementDeclarationsIterator& );
-
-    void beginVisit( const InScopeAttributeDeclarationsIterator& );
-    void endVisit  ( const InScopeAttributeDeclarationsIterator& );
-
-    void beginVisit( const InScopeElementGroupsIterator& );
-    void endVisit  ( const InScopeElementGroupsIterator& );
-
-    void beginVisit( const InScopeAttributeGroupsIterator& );
-    void endVisit  ( const InScopeAttributeGroupsIterator& );
-
-    void beginVisit( const OptionIterator& );
-    void endVisit  ( const OptionIterator& );
-
-    void beginVisit( const FunctionAnnotationsIterator& );
-    void endVisit  ( const FunctionAnnotationsIterator& );
-
     void beginVisit( const MemSizeIterator& );
     void endVisit  ( const MemSizeIterator& );
 
@@ -888,6 +813,84 @@
     void beginVisit( const ZorbaIsValidatedIterator& );
     void endVisit  ( const ZorbaIsValidatedIterator& );
 
+    void beginVisit( const SctxBaseUriIterator& );
+    void endVisit  ( const SctxBaseUriIterator& );
+
+    void beginVisit( const SctxBoundarySpacePolicyIterator& );
+    void endVisit  ( const SctxBoundarySpacePolicyIterator& );
+
+    void beginVisit( const SctxConstructionModeIterator& );
+    void endVisit  ( const SctxConstructionModeIterator& );
+
+    void beginVisit( const SctxCopyNamespacesModeIterator& );
+    void endVisit  ( const SctxCopyNamespacesModeIterator& );
+
+    void beginVisit( const SctxDefaultCollationIterator& );
+    void endVisit  ( const SctxDefaultCollationIterator& );
+
+    void beginVisit( const SctxDefaultCollectionTypeIterator& );
+    void endVisit  ( const SctxDefaultCollectionTypeIterator& );
+
+    void beginVisit( const SctxDefaultFunctionNamespaceIterator& );
+    void endVisit  ( const SctxDefaultFunctionNamespaceIterator& );
+
+    void beginVisit( const SctxDefaultOrderIterator& );
+    void endVisit  ( const SctxDefaultOrderIterator& );
+
+    void beginVisit( const SctxFunctionAnnotationsIterator& );
+    void endVisit  ( const SctxFunctionAnnotationsIterator& );
+
+    void beginVisit( const SctxFunctionArgumentsCountIterator& );
+    void endVisit  ( const SctxFunctionArgumentsCountIterator& );
+
+    void beginVisit( const SctxFunctionNamesIterator& );
+    void endVisit  ( const SctxFunctionNamesIterator& );
+
+    void beginVisit( const SctxFunctionsIterator& );
+    void endVisit  ( const SctxFunctionsIterator& );
+
+    void beginVisit( const SctxInScopeAttributeDeclarationsIterator& );
+    void endVisit  ( const SctxInScopeAttributeDeclarationsIterator& );
+
+    void beginVisit( const SctxInScopeAttributeGroupsIterator& );
+    void endVisit  ( const SctxInScopeAttributeGroupsIterator& );
+
+    void beginVisit( const SctxInScopeElementDeclarationsIterator& );
+    void endVisit  ( const SctxInScopeElementDeclarationsIterator& );
+
+    void beginVisit( const SctxInScopeElementGroupsIterator& );
+    void endVisit  ( const SctxInScopeElementGroupsIterator& );
+
+    void beginVisit( const SctxInScopeSchemaTypesIterator& );
+    void endVisit  ( const SctxInScopeSchemaTypesIterator& );
+
+    void beginVisit( const SctxInscopeVariablesIterator& );
+    void endVisit  ( const SctxInscopeVariablesIterator& );
+
+    void beginVisit( const SctxOptionIterator& );
+    void endVisit  ( const SctxOptionIterator& );
+
+    void beginVisit( const SctxOrderingModeIterator& );
+    void endVisit  ( const SctxOrderingModeIterator& );
+
+    void beginVisit( const SctxStaticallyKnownCollationsIterator& );
+    void endVisit  ( const SctxStaticallyKnownCollationsIterator& );
+
+    void beginVisit( const SctxStaticallyKnownDocumentsIterator& );
+    void endVisit  ( const SctxStaticallyKnownDocumentsIterator& );
+
+    void beginVisit( const SctxStaticallyKnownDocumentTypeIterator& );
+    void endVisit  ( const SctxStaticallyKnownDocumentTypeIterator& );
+
+    void beginVisit( const SctxStaticallyKnownNamespaceBindingIterator& );
+    void endVisit  ( const SctxStaticallyKnownNamespaceBindingIterator& );
+
+    void beginVisit( const SctxStaticallyKnownNamespacesIterator& );
+    void endVisit  ( const SctxStaticallyKnownNamespacesIterator& );
+
+    void beginVisit( const SctxXPath10CompatModeIterator& );
+    void endVisit  ( const SctxXPath10CompatModeIterator& );
+
     void beginVisit( const FnConcatIterator& );
     void endVisit  ( const FnConcatIterator& );
 

=== renamed directory 'test/rbkt/ExpQueryResults/zorba/introspection' => 'test/rbkt/ExpQueryResults/zorba/sctx'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-base-uri-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-base-uri-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-boundary-policy-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-boundary-policy-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-boundary-policy-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-boundary-policy-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-boundary-policy-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-boundary-policy-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-collations-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-collations-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-constr-mode-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-constr-mode-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-constr-mode-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-constr-mode-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-constr-mode-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-constr-mode-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-copy-ns-mode-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-copy-ns-mode-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-copy-ns-mode-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-copy-ns-mode-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-copy-ns-mode-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-copy-ns-mode-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-copy-ns-mode-4.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-copy-ns-mode-4.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-copy-ns-mode-5.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-copy-ns-mode-5.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-default-collation-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-default-collation-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-default-collection-type-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-default-collection-type-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-default-fn-ns-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-default-fn-ns-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-default-order-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-default-order-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-default-order-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-default-order-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-default-order-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-default-order-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-doc-type-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-doc-type-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-docs-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-docs-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-4.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-4.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-5.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-5.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-6.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-6.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-7.xml.res'
--- test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res	2013-06-04 21:47:40 +0000
+++ test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-7.xml.res	2013-10-01 03:26:58 +0000
@@ -1,1 +1,1 @@
-QName abs adjust-date-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone analyze-string available-environment-variables avg base-uri boolean ceiling codepoint-equal codepoints-to-string collection compare concat contains count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal default-collation distinct-values doc doc-available document-uri element-with-id empty encode-for-uri ends-with environment-variable error escape-html-uri exactly-one exists false filter floor fold-left fold-right for-each for-each-pair format-date format-dateTime format-integer format-number format-time function-arity function-lookup function-name generate-id has-children head hours-from-dateTime hours-from-duration hours-from-time id idref implicit-timezone in-scope-prefixes index-of innermost insert-before iri-to-uri lang last local-name local-name-from-QName lower-case matches max min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-unicode not number one-or-more outermost parse-xml parse-xml-fragment path position prefix-from-QName put remove replace resolve-QName resolve-uri reverse root round round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time serialize starts-with static-base-uri string string-join string-length string-to-codepoints subsequence substring substring-after substring-before sum tail timezone-from-date timezone-from-dateTime timezone-from-time tokenize trace translate true unordered unparsed-text unparsed-text-available unparsed-text-lines upper-case uri-collection year-from-date year-from-dateTime years-from-duration zero-or-one acos asin atan atan2 cos exp exp10 log log10 pi pow sin sqrt tan base-uri boundary-space-policy construction-mode copy-namespaces-mode default-collation default-collection-type default-function-namespace default-order function-annotations function-arguments-count function-names in-scope-attribute-declarations in-scope-attribute-groups in-scope-element-declarations in-scope-element-groups in-scope-schema-types in-scope-variables option ordering-mode statically-known-collations statically-known-document-type statically-known-documents statically-known-namespace-binding statically-known-namespaces xpath10-compatibility-mode
\ No newline at end of file
+QName abs adjust-date-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone analyze-string available-environment-variables avg base-uri boolean ceiling codepoint-equal codepoints-to-string collection compare concat contains count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal default-collation distinct-values doc doc-available document-uri element-with-id empty encode-for-uri ends-with environment-variable error escape-html-uri exactly-one exists false filter floor fold-left fold-right for-each for-each-pair format-date format-dateTime format-integer format-number format-time function-arity function-lookup function-name generate-id has-children head hours-from-dateTime hours-from-duration hours-from-time id idref implicit-timezone in-scope-prefixes index-of innermost insert-before iri-to-uri lang last local-name local-name-from-QName lower-case matches max min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-unicode not number one-or-more outermost parse-xml parse-xml-fragment path position prefix-from-QName put remove replace resolve-QName resolve-uri reverse root round round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time serialize starts-with static-base-uri string string-join string-length string-to-codepoints subsequence substring substring-after substring-before sum tail timezone-from-date timezone-from-dateTime timezone-from-time tokenize trace translate true unordered unparsed-text unparsed-text-available unparsed-text-lines upper-case uri-collection year-from-date year-from-dateTime years-from-duration zero-or-one acos asin atan atan2 cos exp exp10 log log10 pi pow sin sqrt tan base-uri boundary-space-policy construction-mode copy-namespaces-mode default-collation default-collection-type default-function-namespace default-order function-annotations function-arguments-count function-names functions in-scope-attribute-declarations in-scope-attribute-groups in-scope-element-declarations in-scope-element-groups in-scope-schema-types in-scope-variables option ordering-mode statically-known-collations statically-known-document-type statically-known-documents statically-known-namespace-binding statically-known-namespaces xpath10-compatibility-mode

=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-annot-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-annot-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-arg-count-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-arg-count-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-arg-count-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-arg-count-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-arg-count-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-fn-arg-count-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-function-names1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-function-names1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/introspection/introsp-function-names1.xml.res	2013-02-07 17:24:36 +0000
+++ test/rbkt/ExpQueryResults/zorba/sctx/sctx-function-names1.xml.res	2013-10-01 03:26:58 +0000
@@ -1,1 +1,1 @@
-http://www.w3.org/2005/xpath-functions http://www.w3.org/2005/xpath-functions/math http://www.zorba-xquery.com/modules/introspection/sctx
\ No newline at end of file
+http://www.w3.org/2005/xpath-functions http://www.w3.org/2005/xpath-functions/math http://zorba.io/modules/sctx

=== added file 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-functions-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/sctx/sctx-functions-01.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/sctx/sctx-functions-01.xml.res	2013-10-01 03:26:58 +0000
@@ -0,0 +1,730 @@
+{
+  "name" : "QName", 
+  "arity" : 2
+}{
+  "name" : "abs", 
+  "arity" : 1
+}{
+  "name" : "adjust-date-to-timezone", 
+  "arity" : 1
+}{
+  "name" : "adjust-date-to-timezone", 
+  "arity" : 2
+}{
+  "name" : "adjust-dateTime-to-timezone", 
+  "arity" : 1
+}{
+  "name" : "adjust-dateTime-to-timezone", 
+  "arity" : 2
+}{
+  "name" : "adjust-time-to-timezone", 
+  "arity" : 1
+}{
+  "name" : "adjust-time-to-timezone", 
+  "arity" : 2
+}{
+  "name" : "analyze-string", 
+  "arity" : 2
+}{
+  "name" : "analyze-string", 
+  "arity" : 3
+}{
+  "name" : "available-environment-variables", 
+  "arity" : 0
+}{
+  "name" : "avg", 
+  "arity" : 1
+}{
+  "name" : "base-uri", 
+  "arity" : 0
+}{
+  "name" : "base-uri", 
+  "arity" : 1
+}{
+  "name" : "boolean", 
+  "arity" : 1
+}{
+  "name" : "ceiling", 
+  "arity" : 1
+}{
+  "name" : "codepoint-equal", 
+  "arity" : 2
+}{
+  "name" : "codepoints-to-string", 
+  "arity" : 1
+}{
+  "name" : "collection", 
+  "arity" : 0
+}{
+  "name" : "collection", 
+  "arity" : 1
+}{
+  "name" : "compare", 
+  "arity" : 2
+}{
+  "name" : "compare", 
+  "arity" : 3
+}{
+  "name" : "concat", 
+  "arity" : 1000000
+}{
+  "name" : "contains", 
+  "arity" : 2
+}{
+  "name" : "contains", 
+  "arity" : 3
+}{
+  "name" : "count", 
+  "arity" : 1
+}{
+  "name" : "current-date", 
+  "arity" : 0
+}{
+  "name" : "current-dateTime", 
+  "arity" : 0
+}{
+  "name" : "current-time", 
+  "arity" : 0
+}{
+  "name" : "data", 
+  "arity" : 0
+}{
+  "name" : "data", 
+  "arity" : 1
+}{
+  "name" : "dateTime", 
+  "arity" : 2
+}{
+  "name" : "day-from-date", 
+  "arity" : 1
+}{
+  "name" : "day-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "days-from-duration", 
+  "arity" : 1
+}{
+  "name" : "deep-equal", 
+  "arity" : 2
+}{
+  "name" : "deep-equal", 
+  "arity" : 3
+}{
+  "name" : "default-collation", 
+  "arity" : 0
+}{
+  "name" : "distinct-values", 
+  "arity" : 1
+}{
+  "name" : "distinct-values", 
+  "arity" : 2
+}{
+  "name" : "doc", 
+  "arity" : 1
+}{
+  "name" : "doc-available", 
+  "arity" : 1
+}{
+  "name" : "document-uri", 
+  "arity" : 0
+}{
+  "name" : "document-uri", 
+  "arity" : 1
+}{
+  "name" : "element-with-id", 
+  "arity" : 1
+}{
+  "name" : "element-with-id", 
+  "arity" : 2
+}{
+  "name" : "empty", 
+  "arity" : 1
+}{
+  "name" : "encode-for-uri", 
+  "arity" : 1
+}{
+  "name" : "ends-with", 
+  "arity" : 2
+}{
+  "name" : "ends-with", 
+  "arity" : 3
+}{
+  "name" : "environment-variable", 
+  "arity" : 1
+}{
+  "name" : "error", 
+  "arity" : 0
+}{
+  "name" : "error", 
+  "arity" : 1
+}{
+  "name" : "error", 
+  "arity" : 2
+}{
+  "name" : "error", 
+  "arity" : 3
+}{
+  "name" : "escape-html-uri", 
+  "arity" : 1
+}{
+  "name" : "exactly-one", 
+  "arity" : 1
+}{
+  "name" : "exists", 
+  "arity" : 1
+}{
+  "name" : "false", 
+  "arity" : 0
+}{
+  "name" : "filter", 
+  "arity" : 2
+}{
+  "name" : "floor", 
+  "arity" : 1
+}{
+  "name" : "fold-left", 
+  "arity" : 3
+}{
+  "name" : "fold-right", 
+  "arity" : 3
+}{
+  "name" : "for-each", 
+  "arity" : 2
+}{
+  "name" : "for-each-pair", 
+  "arity" : 3
+}{
+  "name" : "format-date", 
+  "arity" : 2
+}{
+  "name" : "format-date", 
+  "arity" : 5
+}{
+  "name" : "format-dateTime", 
+  "arity" : 2
+}{
+  "name" : "format-dateTime", 
+  "arity" : 5
+}{
+  "name" : "format-integer", 
+  "arity" : 2
+}{
+  "name" : "format-integer", 
+  "arity" : 3
+}{
+  "name" : "format-number", 
+  "arity" : 2
+}{
+  "name" : "format-number", 
+  "arity" : 3
+}{
+  "name" : "format-time", 
+  "arity" : 2
+}{
+  "name" : "format-time", 
+  "arity" : 5
+}{
+  "name" : "function-arity", 
+  "arity" : 1
+}{
+  "name" : "function-lookup", 
+  "arity" : 2
+}{
+  "name" : "function-name", 
+  "arity" : 1
+}{
+  "name" : "generate-id", 
+  "arity" : 0
+}{
+  "name" : "generate-id", 
+  "arity" : 1
+}{
+  "name" : "has-children", 
+  "arity" : 0
+}{
+  "name" : "has-children", 
+  "arity" : 1
+}{
+  "name" : "head", 
+  "arity" : 1
+}{
+  "name" : "hours-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "hours-from-duration", 
+  "arity" : 1
+}{
+  "name" : "hours-from-time", 
+  "arity" : 1
+}{
+  "name" : "id", 
+  "arity" : 1
+}{
+  "name" : "id", 
+  "arity" : 2
+}{
+  "name" : "idref", 
+  "arity" : 1
+}{
+  "name" : "idref", 
+  "arity" : 2
+}{
+  "name" : "implicit-timezone", 
+  "arity" : 0
+}{
+  "name" : "in-scope-prefixes", 
+  "arity" : 1
+}{
+  "name" : "index-of", 
+  "arity" : 2
+}{
+  "name" : "index-of", 
+  "arity" : 3
+}{
+  "name" : "innermost", 
+  "arity" : 1
+}{
+  "name" : "insert-before", 
+  "arity" : 3
+}{
+  "name" : "iri-to-uri", 
+  "arity" : 1
+}{
+  "name" : "lang", 
+  "arity" : 1
+}{
+  "name" : "lang", 
+  "arity" : 2
+}{
+  "name" : "last", 
+  "arity" : 0
+}{
+  "name" : "local-name", 
+  "arity" : 0
+}{
+  "name" : "local-name", 
+  "arity" : 1
+}{
+  "name" : "local-name-from-QName", 
+  "arity" : 1
+}{
+  "name" : "lower-case", 
+  "arity" : 1
+}{
+  "name" : "matches", 
+  "arity" : 2
+}{
+  "name" : "matches", 
+  "arity" : 3
+}{
+  "name" : "max", 
+  "arity" : 1
+}{
+  "name" : "max", 
+  "arity" : 2
+}{
+  "name" : "min", 
+  "arity" : 1
+}{
+  "name" : "min", 
+  "arity" : 2
+}{
+  "name" : "minutes-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "minutes-from-duration", 
+  "arity" : 1
+}{
+  "name" : "minutes-from-time", 
+  "arity" : 1
+}{
+  "name" : "month-from-date", 
+  "arity" : 1
+}{
+  "name" : "month-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "months-from-duration", 
+  "arity" : 1
+}{
+  "name" : "name", 
+  "arity" : 0
+}{
+  "name" : "name", 
+  "arity" : 1
+}{
+  "name" : "namespace-uri", 
+  "arity" : 0
+}{
+  "name" : "namespace-uri", 
+  "arity" : 1
+}{
+  "name" : "namespace-uri-for-prefix", 
+  "arity" : 2
+}{
+  "name" : "namespace-uri-from-QName", 
+  "arity" : 1
+}{
+  "name" : "nilled", 
+  "arity" : 0
+}{
+  "name" : "nilled", 
+  "arity" : 1
+}{
+  "name" : "node-name", 
+  "arity" : 0
+}{
+  "name" : "node-name", 
+  "arity" : 1
+}{
+  "name" : "normalize-space", 
+  "arity" : 0
+}{
+  "name" : "normalize-space", 
+  "arity" : 1
+}{
+  "name" : "normalize-unicode", 
+  "arity" : 1
+}{
+  "name" : "normalize-unicode", 
+  "arity" : 2
+}{
+  "name" : "not", 
+  "arity" : 1
+}{
+  "name" : "number", 
+  "arity" : 0
+}{
+  "name" : "number", 
+  "arity" : 1
+}{
+  "name" : "one-or-more", 
+  "arity" : 1
+}{
+  "name" : "outermost", 
+  "arity" : 1
+}{
+  "name" : "parse-xml", 
+  "arity" : 1
+}{
+  "name" : "parse-xml-fragment", 
+  "arity" : 1
+}{
+  "name" : "path", 
+  "arity" : 0
+}{
+  "name" : "path", 
+  "arity" : 1
+}{
+  "name" : "position", 
+  "arity" : 0
+}{
+  "name" : "prefix-from-QName", 
+  "arity" : 1
+}{
+  "name" : "put", 
+  "arity" : 2
+}{
+  "name" : "remove", 
+  "arity" : 2
+}{
+  "name" : "replace", 
+  "arity" : 3
+}{
+  "name" : "replace", 
+  "arity" : 4
+}{
+  "name" : "resolve-QName", 
+  "arity" : 2
+}{
+  "name" : "resolve-uri", 
+  "arity" : 1
+}{
+  "name" : "resolve-uri", 
+  "arity" : 2
+}{
+  "name" : "reverse", 
+  "arity" : 1
+}{
+  "name" : "root", 
+  "arity" : 0
+}{
+  "name" : "root", 
+  "arity" : 1
+}{
+  "name" : "round", 
+  "arity" : 1
+}{
+  "name" : "round", 
+  "arity" : 2
+}{
+  "name" : "round-half-to-even", 
+  "arity" : 1
+}{
+  "name" : "round-half-to-even", 
+  "arity" : 2
+}{
+  "name" : "seconds-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "seconds-from-duration", 
+  "arity" : 1
+}{
+  "name" : "seconds-from-time", 
+  "arity" : 1
+}{
+  "name" : "serialize", 
+  "arity" : 1
+}{
+  "name" : "serialize", 
+  "arity" : 2
+}{
+  "name" : "starts-with", 
+  "arity" : 2
+}{
+  "name" : "starts-with", 
+  "arity" : 3
+}{
+  "name" : "static-base-uri", 
+  "arity" : 0
+}{
+  "name" : "string", 
+  "arity" : 0
+}{
+  "name" : "string", 
+  "arity" : 1
+}{
+  "name" : "string-join", 
+  "arity" : 1
+}{
+  "name" : "string-join", 
+  "arity" : 2
+}{
+  "name" : "string-length", 
+  "arity" : 0
+}{
+  "name" : "string-length", 
+  "arity" : 1
+}{
+  "name" : "string-to-codepoints", 
+  "arity" : 1
+}{
+  "name" : "subsequence", 
+  "arity" : 2
+}{
+  "name" : "subsequence", 
+  "arity" : 3
+}{
+  "name" : "substring", 
+  "arity" : 2
+}{
+  "name" : "substring", 
+  "arity" : 3
+}{
+  "name" : "substring-after", 
+  "arity" : 2
+}{
+  "name" : "substring-after", 
+  "arity" : 3
+}{
+  "name" : "substring-before", 
+  "arity" : 2
+}{
+  "name" : "substring-before", 
+  "arity" : 3
+}{
+  "name" : "sum", 
+  "arity" : 1
+}{
+  "name" : "sum", 
+  "arity" : 2
+}{
+  "name" : "tail", 
+  "arity" : 1
+}{
+  "name" : "timezone-from-date", 
+  "arity" : 1
+}{
+  "name" : "timezone-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "timezone-from-time", 
+  "arity" : 1
+}{
+  "name" : "tokenize", 
+  "arity" : 2
+}{
+  "name" : "tokenize", 
+  "arity" : 3
+}{
+  "name" : "trace", 
+  "arity" : 2
+}{
+  "name" : "translate", 
+  "arity" : 3
+}{
+  "name" : "true", 
+  "arity" : 0
+}{
+  "name" : "unordered", 
+  "arity" : 1
+}{
+  "name" : "unparsed-text", 
+  "arity" : 1
+}{
+  "name" : "unparsed-text", 
+  "arity" : 2
+}{
+  "name" : "unparsed-text-available", 
+  "arity" : 1
+}{
+  "name" : "unparsed-text-available", 
+  "arity" : 2
+}{
+  "name" : "unparsed-text-lines", 
+  "arity" : 1
+}{
+  "name" : "unparsed-text-lines", 
+  "arity" : 2
+}{
+  "name" : "upper-case", 
+  "arity" : 1
+}{
+  "name" : "uri-collection", 
+  "arity" : 0
+}{
+  "name" : "uri-collection", 
+  "arity" : 1
+}{
+  "name" : "year-from-date", 
+  "arity" : 1
+}{
+  "name" : "year-from-dateTime", 
+  "arity" : 1
+}{
+  "name" : "years-from-duration", 
+  "arity" : 1
+}{
+  "name" : "zero-or-one", 
+  "arity" : 1
+}{
+  "name" : "acos", 
+  "arity" : 1
+}{
+  "name" : "asin", 
+  "arity" : 1
+}{
+  "name" : "atan", 
+  "arity" : 1
+}{
+  "name" : "atan2", 
+  "arity" : 2
+}{
+  "name" : "cos", 
+  "arity" : 1
+}{
+  "name" : "exp", 
+  "arity" : 1
+}{
+  "name" : "exp10", 
+  "arity" : 1
+}{
+  "name" : "log", 
+  "arity" : 1
+}{
+  "name" : "log10", 
+  "arity" : 1
+}{
+  "name" : "pi", 
+  "arity" : 0
+}{
+  "name" : "pow", 
+  "arity" : 2
+}{
+  "name" : "sin", 
+  "arity" : 1
+}{
+  "name" : "sqrt", 
+  "arity" : 1
+}{
+  "name" : "tan", 
+  "arity" : 1
+}{
+  "name" : "base-uri", 
+  "arity" : 0
+}{
+  "name" : "boundary-space-policy", 
+  "arity" : 0
+}{
+  "name" : "construction-mode", 
+  "arity" : 0
+}{
+  "name" : "copy-namespaces-mode", 
+  "arity" : 0
+}{
+  "name" : "default-collation", 
+  "arity" : 0
+}{
+  "name" : "default-collection-type", 
+  "arity" : 0
+}{
+  "name" : "default-function-namespace", 
+  "arity" : 0
+}{
+  "name" : "default-order", 
+  "arity" : 0
+}{
+  "name" : "function-annotations", 
+  "arity" : 2
+}{
+  "name" : "function-arguments-count", 
+  "arity" : 1
+}{
+  "name" : "function-names", 
+  "arity" : 0
+}{
+  "name" : "functions", 
+  "arity" : 0
+}{
+  "name" : "in-scope-attribute-declarations", 
+  "arity" : 0
+}{
+  "name" : "in-scope-attribute-groups", 
+  "arity" : 0
+}{
+  "name" : "in-scope-element-declarations", 
+  "arity" : 0
+}{
+  "name" : "in-scope-element-groups", 
+  "arity" : 0
+}{
+  "name" : "in-scope-schema-types", 
+  "arity" : 0
+}{
+  "name" : "in-scope-variables", 
+  "arity" : 0
+}{
+  "name" : "option", 
+  "arity" : 1
+}{
+  "name" : "ordering-mode", 
+  "arity" : 0
+}{
+  "name" : "statically-known-collations", 
+  "arity" : 0
+}{
+  "name" : "statically-known-document-type", 
+  "arity" : 1
+}{
+  "name" : "statically-known-documents", 
+  "arity" : 0
+}{
+  "name" : "statically-known-namespace-binding", 
+  "arity" : 1
+}{
+  "name" : "statically-known-namespaces", 
+  "arity" : 0
+}{
+  "name" : "xpath10-compatibility-mode", 
+  "arity" : 0
+}

=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-known-document-type-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-known-document-type-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-known-documents-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-known-documents-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-3.xml.res'
--- test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-3.xml.res	2013-02-07 17:24:36 +0000
+++ test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-3.xml.res	2013-10-01 03:26:58 +0000
@@ -1,2 +1,1 @@
-<?xml version="1.0" encoding="UTF-8"?>
-true
\ No newline at end of file
+http://zorba.io/modules/sctx

=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-4.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-4.xml.res	2013-02-07 17:24:36 +0000
+++ test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-4.xml.res	2013-10-01 03:26:58 +0000
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-http://www.zorba-xquery.com/test
\ No newline at end of file
+http://zorba.io/test

=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ns-5.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ns-5.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-options-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-options-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ordering-mode-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ordering-mode-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ordering-mode-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ordering-mode-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-ordering-mode-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-ordering-mode-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-attrib-groups-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-attrib-groups-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-attributes-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-attributes-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-elem-groups-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-elem-groups-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-elements-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-elements-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-4.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-4.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-5.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-5.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-6.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-6.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-7.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-7.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-8.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-8.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-schema-types-9.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-schema-types-9.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-vars-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-vars-1.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-vars-2.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-vars-2.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-vars-3.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-vars-3.xml.res'
=== renamed file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-xpath-1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/sctx/sctx-xpath-1.xml.res'
=== renamed directory 'test/rbkt/Queries/zorba/introspection' => 'test/rbkt/Queries/zorba/sctx'
=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-base-uri-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-base-uri-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-base-uri-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-base-uri-1.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare base-uri "http://example.zorba-xquery.com/";;
 

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-boundary-policy-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-boundary-policy-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-boundary-policy-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-boundary-policy-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:boundary-space-policy()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-boundary-policy-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-boundary-policy-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-boundary-policy-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-boundary-policy-2.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare boundary-space strip;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:boundary-space-policy()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-boundary-policy-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-boundary-policy-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-boundary-policy-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-boundary-policy-3.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare boundary-space preserve;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:boundary-space-policy()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-collations-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-collations-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-collations-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-collations-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-count(sctx:statically-known-collations())
\ No newline at end of file
+count(sctx:statically-known-collations())

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-constr-mode-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-constr-mode-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-constr-mode-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-constr-mode-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:construction-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-constr-mode-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-constr-mode-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-constr-mode-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-constr-mode-2.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare construction preserve;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:construction-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-constr-mode-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-constr-mode-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-constr-mode-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-constr-mode-3.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare construction strip;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:construction-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:copy-namespaces-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-2.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare copy-namespaces preserve, inherit;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:copy-namespaces-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-3.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare copy-namespaces no-preserve, inherit;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:copy-namespaces-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-4.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-4.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-4.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-4.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare copy-namespaces preserve, no-inherit;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:copy-namespaces-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-5.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-5.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-copy-ns-mode-5.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-copy-ns-mode-5.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare copy-namespaces no-preserve, no-inherit;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:copy-namespaces-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-default-collation-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-default-collation-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-default-collation-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-default-collation-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:default-collation()
\ No newline at end of file
+sctx:default-collation()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-default-collection-type-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-default-collection-type-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-default-collection-type-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-default-collection-type-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:default-collection-type()
\ No newline at end of file
+sctx:default-collection-type()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-default-fn-ns-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-default-fn-ns-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-default-fn-ns-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-default-fn-ns-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:default-function-namespace()
\ No newline at end of file
+sctx:default-function-namespace()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-default-order-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-default-order-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-default-order-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-default-order-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:default-order()
\ No newline at end of file
+sctx:default-order()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-default-order-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-default-order-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-default-order-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-default-order-2.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare default order empty greatest;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:default-order()
\ No newline at end of file
+sctx:default-order()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-default-order-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-default-order-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-default-order-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-default-order-3.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare default order empty least;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:default-order()
\ No newline at end of file
+sctx:default-order()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-doc-type-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-doc-type-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-doc-type-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-doc-type-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:statically-known-document-type("document-not-known")
\ No newline at end of file
+sctx:statically-known-document-type("document-not-known")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-docs-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-docs-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-docs-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-docs-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-count(sctx:statically-known-documents())
\ No newline at end of file
+count(sctx:statically-known-documents())

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 count(sctx:function-names()) > 100

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-2.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:function-names() = xs:QName("fn:abs")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-3.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:function-names() = xs:QName("fn:string-to-codepoints")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-4.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-4.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-4.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-4.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:function-names() = xs:QName("sctx:function-names")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-5.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-5.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-5.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-5.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:function-names() = xs:QName("sctx:this-function-does-not-exist")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-6.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-6.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-6.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-6.xq	2013-10-01 03:26:58 +0000
@@ -1,9 +1,7 @@
-
 (: There are two signatures for the "substring" function, 
-   but sctx:function-names() should return only one QName for it
-:)
+   but sctx:function-names() should return only one QName for it. :)
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 let $cnt := count(
   for $func in sctx:function-names()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-7.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-7.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-7.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-7.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 for $x in sctx:function-names()
 order by fn:namespace-uri-from-QName($x), fn:local-name-from-QName($x)

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-annot-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-annot-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-annot-1.xq	2013-04-29 01:51:11 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-annot-1.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare %private function local:private-function()
 {

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-arg-count-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-arg-count-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-arg-count-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-arg-count-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:function-arguments-count(xs:QName("fn:abs"))

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-arg-count-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-arg-count-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-arg-count-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-arg-count-2.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 sctx:function-arguments-count(xs:QName("sctx:function-names"))

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-fn-arg-count-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-fn-arg-count-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-fn-arg-count-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-fn-arg-count-3.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 count(sctx:function-arguments-count(xs:QName("fn:max")))

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-function-names1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-function-names1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-function-names1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-function-names1.xq	2013-10-01 03:26:58 +0000
@@ -1,6 +1,7 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 fn:distinct-values(
-for $funcQname in sctx:function-names()
-order by fn:namespace-uri-from-QName($funcQname)
-return fn:namespace-uri-from-QName($funcQname))
\ No newline at end of file
+  for $funcQname in sctx:function-names()
+  order by fn:namespace-uri-from-QName($funcQname)
+  return fn:namespace-uri-from-QName($funcQname)
+)

=== added file 'test/rbkt/Queries/zorba/sctx/sctx-functions-01.jq'
--- test/rbkt/Queries/zorba/sctx/sctx-functions-01.jq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-functions-01.jq	2013-10-01 03:26:58 +0000
@@ -0,0 +1,11 @@
+jsoniq version "1.0";
+
+import module namespace sctx = "http://zorba.io/modules/sctx";;
+
+for $f in sctx:functions()
+order by namespace-uri-from-QName($f.name),
+         local-name-from-QName($f.name),
+         $f.arity
+return $f
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/sctx/sctx-functions-01.spec'
--- test/rbkt/Queries/zorba/sctx/sctx-functions-01.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-functions-01.spec	2013-10-01 03:26:58 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-known-document-type-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-known-document-type-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-known-document-type-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-known-document-type-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:statically-known-document-type("unknown document")
\ No newline at end of file
+sctx:statically-known-document-type("unknown document")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-known-documents-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-known-documents-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-known-documents-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-known-documents-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-count(sctx:statically-known-documents()) = 0
\ No newline at end of file
+count(sctx:statically-known-documents()) = 0

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ns-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ns-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ns-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ns-1.xq	2013-10-01 03:26:58 +0000
@@ -2,7 +2,7 @@
  :  Check that all default statically known namespaces are present 
  :)
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 let $namespaces := sctx:statically-known-namespaces()
 return (

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ns-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ns-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ns-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ns-2.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare namespace test = "http://www.zorba-xquery.com/test";;
 

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ns-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ns-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ns-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ns-3.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:statically-known-namespace-binding("sctx") eq "http://www.zorba-xquery.com/modules/introspection/sctx";
\ No newline at end of file
+sctx:statically-known-namespace-binding( "sctx" )

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ns-4.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ns-4.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ns-4.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ns-4.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
-
-declare namespace test = "http://www.zorba-xquery.com/test";;
-
-sctx:statically-known-namespace-binding("test")
\ No newline at end of file
+import module namespace sctx = "http://zorba.io/modules/sctx";; 
+
+declare namespace test = "http://zorba.io/test";;
+
+sctx:statically-known-namespace-binding("test")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ns-5.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ns-5.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ns-5.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ns-5.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";; 
 
-count(sctx:statically-known-namespace-binding("empty"))
\ No newline at end of file
+count(sctx:statically-known-namespace-binding("empty"))

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-options-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-options-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-options-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-options-1.xq	2013-10-01 03:26:58 +0000
@@ -1,6 +1,6 @@
 declare namespace op = "http://www.zorba-xquery.org/options";;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare option op:trace "disable";
 declare option op:blub "foo";

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ordering-mode-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ordering-mode-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ordering-mode-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ordering-mode-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:ordering-mode()
\ No newline at end of file
+sctx:ordering-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ordering-mode-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ordering-mode-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ordering-mode-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ordering-mode-2.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare ordering ordered;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:ordering-mode()
\ No newline at end of file
+sctx:ordering-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-ordering-mode-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-ordering-mode-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-ordering-mode-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-ordering-mode-3.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
 declare ordering unordered;
 
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:ordering-mode()
\ No newline at end of file
+sctx:ordering-mode()

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-attrib-groups-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-attrib-groups-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-attrib-groups-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-attrib-groups-1.xq	2013-10-01 03:26:58 +0000
@@ -1,6 +1,6 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
 sctx:in-scope-attribute-groups() = xs:QName("types:personattr"),
 sctx:in-scope-attribute-groups() = xs:QName("xs:personattr"),
-sctx:in-scope-attribute-groups() = xs:QName("types:custGroup")
\ No newline at end of file
+sctx:in-scope-attribute-groups() = xs:QName("types:custGroup")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-attributes-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-attributes-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-attributes-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-attributes-1.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
 sctx:in-scope-attribute-declarations() = xs:QName("types:myAttribute"),

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-elem-groups-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-elem-groups-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-elem-groups-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-elem-groups-1.xq	2013-10-01 03:26:58 +0000
@@ -1,6 +1,6 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
 sctx:in-scope-element-groups() = xs:QName("types:custGroup"),
 sctx:in-scope-element-groups() = xs:QName("xs:custGroup"),
-sctx:in-scope-element-groups() = xs:QName("types:personattr")
\ No newline at end of file
+sctx:in-scope-element-groups() = xs:QName("types:personattr")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-elements-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-elements-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-elements-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-elements-1.xq	2013-10-01 03:26:58 +0000
@@ -1,6 +1,6 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
 sctx:in-scope-element-declarations() = xs:QName("types:myProduct"),
 sctx:in-scope-element-declarations() = xs:QName("xs:myProduct"),
-sctx:in-scope-element-declarations() = xs:QName("types:mySimpleType")
\ No newline at end of file
+sctx:in-scope-element-declarations() = xs:QName("types:mySimpleType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-1.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-count(sctx:in-scope-schema-types()) > 5
\ No newline at end of file
+count(sctx:in-scope-schema-types()) > 5

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-2.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-sctx:in-scope-schema-types() = xs:QName("types:mySimpleType")
\ No newline at end of file
+sctx:in-scope-schema-types() = xs:QName("types:mySimpleType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-3.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-sctx:in-scope-schema-types() = xs:QName("xs:anyType")
\ No newline at end of file
+sctx:in-scope-schema-types() = xs:QName("xs:anyType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-4.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-4.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-4.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-4.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-sctx:in-scope-schema-types() = xs:QName("types:anyType")
\ No newline at end of file
+sctx:in-scope-schema-types() = xs:QName("types:anyType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-5.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-5.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-5.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-5.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-sctx:in-scope-schema-types() = xs:QName("anyType")
\ No newline at end of file
+sctx:in-scope-schema-types() = xs:QName("anyType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-6.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-6.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-6.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-6.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-sctx:in-scope-schema-types() = xs:QName("xs:mySimpleType")
\ No newline at end of file
+sctx:in-scope-schema-types() = xs:QName("xs:mySimpleType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-7.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-7.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-7.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-7.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
-sctx:in-scope-schema-types() = xs:QName("types:mySimpleType")
\ No newline at end of file
+sctx:in-scope-schema-types() = xs:QName("types:mySimpleType")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-8.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-8.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-8.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-8.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
 sctx:in-scope-schema-types() = xs:QName("types:myComplex"),

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-schema-types-9.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-schema-types-9.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-schema-types-9.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-schema-types-9.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";;
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 import schema namespace types = "http://www.zorba-xquery.com/types"; at "types.xsd";
 
 sctx:in-scope-schema-types() = xs:QName("xs:string"),

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-vars-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-vars-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-vars-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-vars-1.xq	2013-10-01 03:26:58 +0000
@@ -1,4 +1,4 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 for $var in sctx:in-scope-variables()
 order by xs:string($var)

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-vars-2.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-vars-2.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-vars-2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-vars-2.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare variable $test := "test";
 
-sctx:in-scope-variables() = xs:QName("test")
\ No newline at end of file
+sctx:in-scope-variables() = xs:QName("test")

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-vars-3.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-vars-3.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-vars-3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-vars-3.xq	2013-10-01 03:26:58 +0000
@@ -1,5 +1,5 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
 declare variable $test := "test";
 
-count(sctx:in-scope-variables())
\ No newline at end of file
+count(sctx:in-scope-variables())

=== renamed file 'test/rbkt/Queries/zorba/introspection/introsp-xpath-1.xq' => 'test/rbkt/Queries/zorba/sctx/sctx-xpath-1.xq'
--- test/rbkt/Queries/zorba/introspection/introsp-xpath-1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/sctx-xpath-1.xq	2013-10-01 03:26:58 +0000
@@ -1,3 +1,3 @@
-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";; 
+import module namespace sctx = "http://zorba.io/modules/sctx";;
 
-sctx:xpath10-compatibility-mode()
\ No newline at end of file
+sctx:xpath10-compatibility-mode()

=== modified file 'test/rbkt/Queries/zorba/sctx/types.xsd'
--- test/rbkt/Queries/zorba/introspection/types.xsd	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/sctx/types.xsd	2013-10-01 03:26:58 +0000
@@ -16,9 +16,9 @@
   </xs:complexType>
 
   <xs:element name="myProduct">
-     <xs:complexType>
-       <xs:attribute name="prodid" type="xs:positiveInteger"/>
-     </xs:complexType>
+    <xs:complexType>
+      <xs:attribute name="prodid" type="xs:positiveInteger"/>
+    </xs:complexType>
   </xs:element>
 
   <xs:group name="custGroup">
@@ -40,3 +40,4 @@
   </xs:complexType> 
 
 </xs:schema>
+<!-- vim:set et sw=2 ts=2: -->


Follow ups