[bugfix] Index panel throws exception when it encountered a lucene index definition using e.g. match="//tei:body/tei:div": multiple namespace declarations for the same prefix in prolog.

svn path=/trunk/eXist/; revision=15564

xquery version "1.0";

(:
    Module: Browse Indexes: See an overview of .xconf files stored in /db/system/config,
    and browse the associated index keys.
:)

module namespace indexes="http://exist-db.org/xquery/admin-interface/indexes";

declare namespace cc="http://exist-db.org/collection-config/1.0";

declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=no enforce-xhtml=yes";

(:
    Global variables - derived from URL parameters
:)
declare variable $indexes:start-value := request:get-parameter('start-value', '');
declare variable $indexes:callback := util:function(xs:QName("indexes:term-callback"), 2);
declare variable $indexes:max-number-returned := xs:integer(request:get-parameter('max', 100));
declare variable $indexes:index := request:get-parameter('index', '');
declare variable $indexes:sortby := request:get-parameter('sortby', 'term');
declare variable $indexes:sortorder := request:get-parameter('sortorder', 'ascending');
declare variable $indexes:node-name := request:get-parameter('node-name', '');
declare variable $indexes:match := request:get-parameter('match', '');
declare variable $indexes:collection := request:get-parameter('collection', '');
declare variable $indexes:node-set :=
    if ($indexes:node-name ne '' and $indexes:collection ne '') then
        indexes:get-nodeset-from-qname($indexes:collection, $indexes:node-name)
    else if ($indexes:match ne '' and $indexes:collection ne '') then
        indexes:get-nodeset-from-match($indexes:collection, $indexes:match)
    else
        ();
declare variable $indexes:qname :=
    if ($indexes:node-name ne '') then
        if (not(matches($indexes:node-name, 'xml:')) and contains($indexes:node-name, ':')) then
            QName(indexes:get-namespace-uri-from-node-name($indexes:node-name, $indexes:collection), $indexes:node-name)
        else
            xs:QName($indexes:node-name)
    else ();
declare variable $indexes:show-keys-by := request:get-parameter('show-keys-by', '');
declare variable $indexes:index-names :=

        <name>Index Types</name>
        <description>This is the list of known index types and their labels.</description>
        <items>
            <item>
                Lucene
                <value>lucene-index</value>
            </item>
            <item>
                NGram
                <value>ngram-index</value>
            </item>
            <item>
                Range
                <value>range-index</value>
            </item>
            <item>
                Legacy Fulltext
                <value>legacy-fulltext-index</value>
            </item>
        </items>
    ;

(:
    Main function: outputs the page.
:)
declare function indexes:main() {
    let $xconfs :=
        for $xconf in collection('/db/system/config/')/cc:collection
        order by util:collection-name($xconf)
        return $xconf
    return
        if (empty($xconfs)) then

Browse Indexes

No Index Configurations were found in the /db/system/config collection.
                    Consider installing eXist's example files or
                    documentation and then returning here
                    to browse the indexes.

        else if (empty($indexes:node-set)) then

            indexes:list-indexes($xconfs)

        else

            indexes:show-index-keys()
};

(:
    Lists indexes.
:)
declare function indexes:list-indexes($xconfs) {

Browse Indexes

This is an overview of the index definitions applied in the database,
            as well as the "index keys" (the actual items stored in the index).

Browsing {count($xconfs)} indexes:

        { indexes:xconf-to-table($xconfs) }

};

(:
    Transforms an index definition into an HTML table.
:)
declare function indexes:xconf-to-table($xconfs as node()*) as item()* {

{
        for $xconf at $count in $xconfs
        let $xconf-collection-name := util:collection-name($xconf)
        let $data-collection-name := substring-after(util:collection-name($xconf), '/db/system/config')
        order by $xconf-collection-name
        return

                {$count}. {$data-collection-name} {if (xmldb:collection-available($data-collection-name)) then () else ' (no data)'}
                    (View xconf file)

                        Item Indexed
                        Index
                        Instances
                        Show Index Keys By

                    {
                    for $entry in ( indexes:analyze-legacy-fulltext-indexes($xconf),
                        indexes:analyze-lucene-indexes($xconf),
                        indexes:analyze-range-indexes($xconf),
                        indexes:analyze-ngram-indexes($xconf) )
                    let $item := $entry/td[1]
                    let $index := $entry/td[2]
                    (: order by $index, $item :)
                    return $entry
                    }

    }

};

(:
    Shows the index keys on a given nodeset or QName
:)
declare function indexes:show-index-keys() {
    let $query-start-time := util:system-time()

    let $keys :=
        (: legacy fulltext index use the text:index-terms() function :)
        if ($indexes:index eq 'legacy-fulltext-index') then
            text:index-terms($indexes:node-set, $indexes:start-value, $indexes:callback, $indexes:max-number-returned)
        (: range indexes can use util:index-keys() without specifying the index :)
        else if ($indexes:index eq 'range-index') then
            if (util:index-type($indexes:node-set) eq 'xs:string') then
                util:index-keys($indexes:node-set, $indexes:start-value, $indexes:callback, $indexes:max-number-returned)
            else
                let $start-value :=
                    if (util:index-type($indexes:node-set) eq 'xs:double') then
                        if ($indexes:start-value castable as xs:double) then xs:double($indexes:start-value) else xs:double(0)
                    else if (util:index-type($indexes:node-set) eq 'xs:float') then
                        if ($indexes:start-value castable as xs:float) then xs:float($indexes:start-value) else xs:float(0)
                    else if (util:index-type($indexes:node-set) eq 'xs:boolean') then
                        if ($indexes:start-value castable as xs:boolean) then xs:boolean($indexes:start-value) else xs:boolean(0)
                    else if (util:index-type($indexes:node-set) eq 'xs:dateTime') then
                        if ($indexes:start-value castable as xs:dateTime) then xs:dateTime($indexes:start-value) else xs:dateTime('0001-01-01T00:00:00-00:00')
                    else if (util:index-type($indexes:node-set) eq 'xs:date') then
                        if ($indexes:start-value castable as xs:date) then xs:date($indexes:start-value) else xs:date('0001-01-01')
                    else
                        if ($indexes:start-value castable as xs:integer) then xs:integer($indexes:start-value)
                    else 0
                return util:index-keys($indexes:node-set, $start-value, $indexes:callback, $indexes:max-number-returned)
        (: all other indexes need to specify the index in the 5th parameter of util:index-keys() :)
        else
            if ($indexes:show-keys-by eq 'node') then
                util:index-keys($indexes:node-set, $indexes:start-value, $indexes:callback, $indexes:max-number-returned, $indexes:index)
            else
                util:index-keys-by-qname($indexes:qname, $indexes:start-value, $indexes:callback, $indexes:max-number-returned, $indexes:index)

    let $log := util:log("DEBUG", concat("INDEXES index type:    ", $indexes:index))
    let $log := util:log("DEBUG", concat("INDEXES qname     :    ", $indexes:qname))

    (:  Reminder for sorting:
           term = $key/td[1]
           frequency := xs:integer($key/td[2])
           documents := xs:integer($key/td[3])
           position := xs:integer($key/td[4])
    :)

    let $sorted-keys :=
        if ($indexes:sortby eq 'term') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by $key/td[1] ascending return $key
            else
                for $key in $keys order by $key/td[1] descending return $key
        else if ($indexes:sortby eq 'frequency') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by xs:integer($key/td[2]) ascending, $key/td[1] ascending return $key
            else
                for $key in $keys order by xs:integer($key/td[2]) descending, $key/td[1] ascending return $key
        else if ($indexes:sortby eq 'documents') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by xs:integer($key/td[3]) ascending, $key/td[1] ascending return $key
            else
                for $key in $keys order by xs:integer($key/td[3]) descending, $key/td[1] ascending return $key
        else if ($indexes:sortby eq 'position') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by xs:integer($key/td[4]) ascending return $key
            else
                for $key in $keys order by xs:integer($key/td[4]) descending return $key
        else $keys

    let $query-end-time := util:system-time()
    let $query-duration := ($query-end-time - $query-start-time) div xs:dayTimeDuration('PT1S')

    return

View Index Keys

Select a different index

{count($keys)} keys returned in {$query-duration}s

Keys for the {indexes:index-name-to-label($indexes:index)} index defined on "{string-join(($indexes:node-name, $indexes:match), '')}" in the {$indexes:collection} collection, by {$indexes:show-keys-by}.

            <form method="get" action="{indexes:remove-parameter-names('start-value')}">

                    Max number returned: <select name="max">{
                        for $number in (10, 100, 1000, 10000)
                        return
                            <option value="{$number}">{if ($number eq $indexes:max-number-returned) then attribute selected {'selected'} else ()}{$number}</option>
                    }</select>

                    Search for terms starting with: <input name="start-value" type="text" value="{$indexes:start-value}"/>
                    {if ($indexes:start-value ne '') then Clear search else ()}
                    {
                    for $param in request:get-parameter-names()[not(. = ('max', 'start-value'))]
                    return
                        <input type="hidden" name="{$param}" value="{request:get-parameter($param, '')}"/>
                    }

                    <input type="submit"/>

            </form>

{
                    for $column in ('term', 'frequency', 'documents', 'position')
                    return
                        {$column} {indexes:sort-direction-indicator($column)}
                }

                { $sorted-keys }

};

(:
    Helper function: Callback function called used in indexes:show-index-keys() for util:index-keys()
:)
declare function indexes:term-callback($term as xs:string, $data as xs:int+) as element() {

        {$term}
        {$data[1]}
        {$data[2]}
        {$data[3]}

};

(:
    Analyzes the Lucene indexes in an index definition
:)
declare function indexes:analyze-lucene-indexes($xconf) {
    let $index-label := indexes:index-name-to-label('lucene-index')
    let $lucene := $xconf/cc:index/cc:lucene
    return if (not($lucene) or not($lucene/cc:text)) then () else
        (
        (: TODO: complete report of default/other Lucene analyzers :)
        (:let $analyzers := $lucene/cc:analyzer
        return
            if ($analyzers) then
                (

Lucene Analyzers

                ,
                for $node in $analyzers
                return
                    if (not($node/@id)) then

default: {concat(' ', $node/@class/string())}

                    else

{$node/@id/string()}: {concat(' ', $node/@class/string())}

                )
            else ()
        ,:)
        let $texts := $lucene//cc:text
        return
            (
            for $text in $texts
            let $qname := if ($text/@qname) then $text/@qname/string() else ()
            let $match := if ($text/@match) then $text/@match/string() else ()
            let $analyzer := if ($text/@analyzer) then $text/@analyzer/string() else ()
            let $collection := substring-after(util:collection-name($text), '/db/system/config')
            let $nodeset := if ($qname) then indexes:get-nodeset-from-qname($collection, $qname) else indexes:get-nodeset-from-match($collection, $match)
            return

                        {if ($qname) then $qname else $match}
                        {if ($text/@boost) then concat(' (boost: ', $text/@boost/string(), ')') else ()}
                        {if ($text/cc:ignore) then (
, concat('(ignore: ', string-join(for $ignore in $text/cc:ignore return $ignore/@qname/string(), ', '), ')')) else ()}
                    {$index-label} {if ($qname) then ' QName' else ' Match'} {if ($analyzer) then concat(' (', $analyzer, ')') else ' (default analyzer)' (: TODO: complete report of default/other Lucene analyzers :)}
                    {count($nodeset)}
                    {
                        if (empty($nodeset)) then ()
                        else
                            (
                            QName
                            ,
                            ', '
                            ,
                            Node
                            )
                    }

            )
        )
};

(:
    Analyzes the legacy fulltext indexes in an index definition
:)
declare function indexes:analyze-legacy-fulltext-indexes($xconf) {
    let $collection := substring-after(util:collection-name($xconf), '/db/system/config')
    let $index := 'legacy-fulltext-index'
    let $index-label := indexes:index-name-to-label($index)
    let $fulltext := $xconf/cc:index/cc:fulltext
    let $creates := $fulltext/cc:create
    let $default-none := $fulltext/@default eq 'none'
    let $attributes-none := $fulltext/@attributes eq 'false'

    let $no-fulltext := if ( not($fulltext) or ($default-none and $attributes-none and not($creates)) ) then '(disabled)' else ()
    return
        if ($no-fulltext) then ()
        else if (not($default-none) and not($attributes-none)) then

                All Elements and Attributes!
                {$index-label}
                {count(collection($collection)//*)} elements and {count(collection($collection)//@*)} attributes
                (Too many to display)

(: is it feasible to display all qnames/nodes here? :)
        else (: if ($creates) then :)
            (
            for $create in $creates
            let $qname := $create/@qname/string()
            let $mixed := $create/@mixed/string()
            return

                    {$qname}
                    {$index-label} {if ($mixed) then '(mixed)' else ()}
                    {count(util:eval(concat('collection(', $collection, ')//', $qname)))}
                    Node

            ,
            let $only-elements-disabled := if ($fulltext/@default eq 'none' and $fulltext/@attributes ne 'no') then '(elements disabled)' else ()
            let $only-attribs-disabled := if ($fulltext/@default ne 'none' and $fulltext/@attributes eq 'no') then '(attributes disabled)' else ()
            return
            if ($only-elements-disabled) then

                    All Attributes!
                    {$index-label}
                    {count(collection($collection)//@*)} attributes
                    (Too many to display)

(: is it feasible to display all qnames/nodes here? :)
            else if ($only-attribs-disabled) then

                    All Elements!
                    {$index-label}
                    {count(collection($collection)//*)} elements
                    (Too many to display)

(: is it feasible to display all qnames/nodes here? :)
            else ()
            )
};

(:
    Analyzes the range indexes in an index definition
:)
declare function indexes:analyze-range-indexes($xconf) {
    let $index-label := indexes:index-name-to-label('range-index')
    let $ranges := $xconf/cc:index/cc:create
    return if (not($ranges)) then () else
        for $range in $ranges
        let $qname := $range/@qname/string()
        let $match := $range/@path/string()
        let $type := $range/@type/string()
        let $collection := substring-after(util:collection-name($range), '/db/system/config')
        let $nodeset := if ($qname) then indexes:get-nodeset-from-qname($collection, $qname) else indexes:get-nodeset-from-match($collection, $match)
        return

                {if ($qname) then $qname else $match}
                {$index-label} {if ($qname) then ' QName' else ' Path'} ({$type})
                {count($nodeset)}
                {
                    if (empty($nodeset)) then ()
                    else
                        Node
                }

};

(:
    Analyzes the NGram indexes in an index definition
:)
declare function indexes:analyze-ngram-indexes($xconf) {
    let $index-label := indexes:index-name-to-label('ngram-index')
    let $ngrams := $xconf/cc:index/cc:ngram
    return if (not($ngrams)) then () else
        for $ngram in $ngrams
        let $qname := $ngram/@qname/string()
        let $collection := substring-after(util:collection-name($ngram), '/db/system/config')
        let $nodeset := indexes:get-nodeset-from-qname($collection, $qname)
        return

                {$qname}
                {$index-label} QName
                {count($nodeset)}
                {
                    if (not(empty($nodeset))) then
                        (
                        QName,
                        ', '
                        ,
                        Node
                        )
                     else ()
                 }

};

(:
    Helper function: Returns a nodeset of instances of a node-name in a collection
:)
declare function indexes:get-nodeset-from-qname($collection as xs:string, $node-name as xs:string) as node()* {
    let $nodeset-expression :=
        concat(
            indexes:get-namespace-declaration-from-node-name($node-name, $collection)
            ,
            'collection("', $collection, '")//', $node-name
        )
    let $log := util:log("DEBUG", concat("INDEXES get-nodeset:          ", $nodeset-expression))
    return
        util:eval($nodeset-expression)
};

(:
    Helper function: Returns a nodeset of instances of a match expression in a collection
:)
declare function indexes:get-nodeset-from-match($collection as xs:string, $match as xs:string) as node()* {
    let $nodeset-expression :=
        concat(
            string-join(
                distinct-values(
                let $node-names := tokenize(replace($match, '//', '/'), '/')
                return
                    for $node-name in $node-names
                    return
                        indexes:get-namespace-declaration-from-node-name($node-name, $collection)
                ), ' ')
            ,
            'collection("', $collection, '")', $match, if (contains($match, '@')) then () else ()
        )
    return
        util:eval($nodeset-expression)
};

(:
    Helper function: Returns the index definition for a given collection
:)
declare function indexes:get-xconf($collection as xs:string) as document-node() {
    let $config-root := '/db/system/config'
    let $xconf-collection := concat($config-root, $collection)
    let $xconf-filename := xmldb:get-child-resources($xconf-collection)[ends-with(., '.xconf')]
    let $xconf := doc(concat($xconf-collection, '/', $xconf-filename))
    return $xconf
};

(:
    Helper function: Looks in the collection.xconf's collection and index elements for namespace URIs for a given node name
:)
declare function indexes:get-namespace-uri-from-node-name($node-name, $collection) {

    let $name := if (starts-with($node-name,'@')) then
                    substring-after( substring-before($node-name, ':'), '@' )
                else
                    substring-before($node-name, ':')

    let $xconf := indexes:get-xconf($collection)
    let $uri := (namespace-uri-for-prefix($name, $xconf/cc:collection), namespace-uri-for-prefix($name, $xconf//cc:index))
    return
        $uri
};

(:
    Helper function: Constructs a namespace declaration for use in util:eval()
:)
declare function indexes:get-namespace-declaration-from-node-name($node-name as xs:string, $collection as xs:string) as xs:string? {
    if (not(matches($node-name, 'xml:')) and contains($node-name, ':')) then

        let $name := if (starts-with($node-name,'@')) then
                        substring-after( substring-before($node-name, ':'), '@' )
                    else
                        substring-before($node-name, ':')

        let $uri := indexes:get-namespace-uri-from-node-name($node-name, $collection)
        return
            concat('declare namespace ', $name, '="', $uri, '"; ')
    else ()
};

(:
    Helper function: gets the label for a given index-name
:)
declare function indexes:index-name-to-label($index-name as xs:string) as xs:string {
    $indexes:index-names//item[value eq $index-name]/label/text()
};

(:
    ====
    Helper functions for modifying the sort order used in indexes:show-index-keys()
    ====
:)
declare function indexes:toggle-sortorder($current-sortorder) {
    indexes:toggle-sortorder($current-sortorder, ())
};

declare function indexes:toggle-sortorder($current-sortorder, $other-new-parameters) {
    let $neworder :=
        if ($current-sortorder eq 'ascending') then
            'sortorder=descending'
        else
            'sortorder=ascending'
    let $new-parameters := ($neworder, $other-new-parameters)
    return
        indexes:replace-parameters($new-parameters)
};

declare function indexes:set-sortorder($current-sortorder, $current-sortby, $new-sortby) {
    if ($current-sortby eq $new-sortby) then
        indexes:toggle-sortorder($current-sortorder)
    else
        indexes:strip-param-from-param-string(indexes:replace-parameters(concat('sortby=', $new-sortby)), 'sortorder')
};

declare function indexes:set-sortorder($new-sortby) {
    indexes:set-sortorder($indexes:sortorder, $indexes:sortby, $new-sortby)
};

declare function indexes:sort-direction-indicator($sortby as xs:string) {
    if ($sortby eq $indexes:sortby) then
        if ($indexes:sortorder eq 'ascending') then
            ' ↓'
        else
            ' ↑'
    else ()
};

(:
    ====
    Helper functions for handling parameters
    ====
:)
declare function indexes:remove-parameter-names($parameter-names-to-remove) {
    let $current-parameter-names := request:get-parameter-names()
    let $remaining-parameters :=
        indexes:remove-parameter-names(
            for $current-parameter-name in $current-parameter-names
            return
                concat($current-parameter-name, '=', request:get-parameter( $current-parameter-name, () ))
            ,
            $parameter-names-to-remove
            )
    return
        if (exists($remaining-parameters)) then
            concat('?', string-join($remaining-parameters, '&'))
        else
            '?'
};

declare function indexes:remove-parameter-names($current-parameters, $parameter-names-to-remove) {
    for $current-parameter in $current-parameters
    return
        if (substring-before($current-parameter, '=') = $parameter-names-to-remove) then
            ()
        else
            $current-parameter
};

declare function indexes:remove-parameter-names-except($parameter-names-to-keep) {
    let $current-parameter-names := request:get-parameter-names()
    return
        indexes:remove-parameter-names($current-parameter-names[not(. = $parameter-names-to-keep)])
};

declare function indexes:replace-parameters($new-parameters) {
    let $current-parameter-names := request:get-parameter-names()
    let $current-parameters :=
        for $name in $current-parameter-names
        return concat($name, '=', request:get-parameter($name, ()))
    return
        indexes:replace-parameters($current-parameters, $new-parameters)
};

declare function indexes:replace-parameters($current-parameters, $new-parameters) {
    let $new-parameter-names := for $new-parameter in $new-parameters return substring-before($new-parameter, '=')
    let $remaining-parameters := indexes:remove-parameter-names($current-parameters, $new-parameter-names)
    let $result-parameters := for $param in ($remaining-parameters, $new-parameters) order by $param return $param
    return
        concat('?', string-join($result-parameters, '&'))
};

declare function indexes:strip-param-from-param-string($param-string, $param) {
    replace($param-string, concat('&?', $param, '=[^&]*?&?.*$'), '')
};

xquery version "1.0";

(:
    Module: Browse Indexes: See an overview of .xconf files stored in /db/system/config,
    and browse the associated index keys.
:)

module namespace indexes="http://exist-db.org/xquery/admin-interface/indexes";

declare namespace cc="http://exist-db.org/collection-config/1.0";

declare option exist:serialize "method=xhtml media-type=text/html omit-xml-declaration=no enforce-xhtml=yes";

(:
    Global variables - derived from URL parameters
:)
declare variable $indexes:start-value := request:get-parameter('start-value', '');
declare variable $indexes:callback := util:function(xs:QName("indexes:term-callback"), 2);
declare variable $indexes:max-number-returned := xs:integer(request:get-parameter('max', 100));
declare variable $indexes:index := request:get-parameter('index', '');
declare variable $indexes:sortby := request:get-parameter('sortby', 'term');
declare variable $indexes:sortorder := request:get-parameter('sortorder', 'ascending');
declare variable $indexes:node-name := request:get-parameter('node-name', '');
declare variable $indexes:match := request:get-parameter('match', '');
declare variable $indexes:collection := request:get-parameter('collection', '');
declare variable $indexes:node-set :=
    if ($indexes:node-name ne '' and $indexes:collection ne '') then
        indexes:get-nodeset-from-qname($indexes:collection, $indexes:node-name)
    else if ($indexes:match ne '' and $indexes:collection ne '') then
        indexes:get-nodeset-from-match($indexes:collection, $indexes:match)
    else
        ();
declare variable $indexes:qname :=
    if ($indexes:node-name ne '') then
        if (not(matches($indexes:node-name, 'xml:')) and contains($indexes:node-name, ':')) then
            QName(indexes:get-namespace-uri-from-node-name($indexes:node-name, $indexes:collection), $indexes:node-name)
        else
            xs:QName($indexes:node-name)
    else ();
declare variable $indexes:show-keys-by := request:get-parameter('show-keys-by', '');
declare variable $indexes:index-names :=

        <name>Index Types</name>
        <description>This is the list of known index types and their labels.</description>
        <items>
            <item>
                Lucene
                <value>lucene-index</value>
            </item>
            <item>
                NGram
                <value>ngram-index</value>
            </item>
            <item>
                Range
                <value>range-index</value>
            </item>
            <item>
                Legacy Fulltext
                <value>legacy-fulltext-index</value>
            </item>
        </items>
    ;

(:
    Main function: outputs the page.
:)
declare function indexes:main() {
    let $xconfs :=
        for $xconf in collection('/db/system/config/')/cc:collection
        order by util:collection-name($xconf)
        return $xconf
    return
        if (empty($xconfs)) then

Browse Indexes

No Index Configurations were found in the /db/system/config collection.
                    Consider installing eXist's example files or
                    documentation and then returning here
                    to browse the indexes.

        else if (empty($indexes:node-set)) then

            indexes:list-indexes($xconfs)

        else

            indexes:show-index-keys()
};

(:
    Lists indexes.
:)
declare function indexes:list-indexes($xconfs) {

Browse Indexes

This is an overview of the index definitions applied in the database,
            as well as the "index keys" (the actual items stored in the index).

Browsing {count($xconfs)} indexes:

        { indexes:xconf-to-table($xconfs) }

};

(:
    Transforms an index definition into an HTML table.
:)
declare function indexes:xconf-to-table($xconfs as node()*) as item()* {

{
        for $xconf at $count in $xconfs
        let $xconf-collection-name := util:collection-name($xconf)
        let $data-collection-name := substring-after(util:collection-name($xconf), '/db/system/config')
        order by $xconf-collection-name
        return

                {$count}. {$data-collection-name} {if (xmldb:collection-available($data-collection-name)) then () else ' (no data)'}
                    (View xconf file)

                        Item Indexed
                        Index
                        Instances
                        Show Index Keys By

                    {
                    for $entry in ( indexes:analyze-legacy-fulltext-indexes($xconf),
                        indexes:analyze-lucene-indexes($xconf),
                        indexes:analyze-range-indexes($xconf),
                        indexes:analyze-ngram-indexes($xconf) )
                    let $item := $entry/td[1]
                    let $index := $entry/td[2]
                    (: order by $index, $item :)
                    return $entry
                    }

    }

};

(:
    Shows the index keys on a given nodeset or QName
:)
declare function indexes:show-index-keys() {
    let $query-start-time := util:system-time()

    let $keys :=
        (: legacy fulltext index use the text:index-terms() function :)
        if ($indexes:index eq 'legacy-fulltext-index') then
            text:index-terms($indexes:node-set, $indexes:start-value, $indexes:callback, $indexes:max-number-returned)
        (: range indexes can use util:index-keys() without specifying the index :)
        else if ($indexes:index eq 'range-index') then
            if (util:index-type($indexes:node-set) eq 'xs:string') then
                util:index-keys($indexes:node-set, $indexes:start-value, $indexes:callback, $indexes:max-number-returned)
            else
                let $start-value :=
                    if (util:index-type($indexes:node-set) eq 'xs:double') then
                        if ($indexes:start-value castable as xs:double) then xs:double($indexes:start-value) else xs:double(0)
                    else if (util:index-type($indexes:node-set) eq 'xs:float') then
                        if ($indexes:start-value castable as xs:float) then xs:float($indexes:start-value) else xs:float(0)
                    else if (util:index-type($indexes:node-set) eq 'xs:boolean') then
                        if ($indexes:start-value castable as xs:boolean) then xs:boolean($indexes:start-value) else xs:boolean(0)
                    else if (util:index-type($indexes:node-set) eq 'xs:dateTime') then
                        if ($indexes:start-value castable as xs:dateTime) then xs:dateTime($indexes:start-value) else xs:dateTime('0001-01-01T00:00:00-00:00')
                    else if (util:index-type($indexes:node-set) eq 'xs:date') then
                        if ($indexes:start-value castable as xs:date) then xs:date($indexes:start-value) else xs:date('0001-01-01')
                    else
                        if ($indexes:start-value castable as xs:integer) then xs:integer($indexes:start-value)
                    else 0
                return util:index-keys($indexes:node-set, $start-value, $indexes:callback, $indexes:max-number-returned)
        (: all other indexes need to specify the index in the 5th parameter of util:index-keys() :)
        else
            if ($indexes:show-keys-by eq 'node') then
                util:index-keys($indexes:node-set, $indexes:start-value, $indexes:callback, $indexes:max-number-returned, $indexes:index)
            else
                util:index-keys-by-qname($indexes:qname, $indexes:start-value, $indexes:callback, $indexes:max-number-returned, $indexes:index)

    let $log := util:log("DEBUG", concat("INDEXES index type:    ", $indexes:index))
    let $log := util:log("DEBUG", concat("INDEXES qname     :    ", $indexes:qname))

    (:  Reminder for sorting:
           term = $key/td[1]
           frequency := xs:integer($key/td[2])
           documents := xs:integer($key/td[3])
           position := xs:integer($key/td[4])
    :)

    let $sorted-keys :=
        if ($indexes:sortby eq 'term') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by $key/td[1] ascending return $key
            else
                for $key in $keys order by $key/td[1] descending return $key
        else if ($indexes:sortby eq 'frequency') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by xs:integer($key/td[2]) ascending, $key/td[1] ascending return $key
            else
                for $key in $keys order by xs:integer($key/td[2]) descending, $key/td[1] ascending return $key
        else if ($indexes:sortby eq 'documents') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by xs:integer($key/td[3]) ascending, $key/td[1] ascending return $key
            else
                for $key in $keys order by xs:integer($key/td[3]) descending, $key/td[1] ascending return $key
        else if ($indexes:sortby eq 'position') then
            if ($indexes:sortorder eq 'ascending') then
                for $key in $keys order by xs:integer($key/td[4]) ascending return $key
            else
                for $key in $keys order by xs:integer($key/td[4]) descending return $key
        else $keys

    let $query-end-time := util:system-time()
    let $query-duration := ($query-end-time - $query-start-time) div xs:dayTimeDuration('PT1S')

    return

View Index Keys

Select a different index

{count($keys)} keys returned in {$query-duration}s

Keys for the {indexes:index-name-to-label($indexes:index)} index defined on "{string-join(($indexes:node-name, $indexes:match), '')}" in the {$indexes:collection} collection, by {$indexes:show-keys-by}.

            <form method="get" action="{indexes:remove-parameter-names('start-value')}">

                    Max number returned: <select name="max">{
                        for $number in (10, 100, 1000, 10000)
                        return
                            <option value="{$number}">{if ($number eq $indexes:max-number-returned) then attribute selected {'selected'} else ()}{$number}</option>
                    }</select>

                    Search for terms starting with: <input name="start-value" type="text" value="{$indexes:start-value}"/>
                    {if ($indexes:start-value ne '') then Clear search else ()}
                    {
                    for $param in request:get-parameter-names()[not(. = ('max', 'start-value'))]
                    return
                        <input type="hidden" name="{$param}" value="{request:get-parameter($param, '')}"/>
                    }

                    <input type="submit"/>

            </form>

{
                    for $column in ('term', 'frequency', 'documents', 'position')
                    return
                        {$column} {indexes:sort-direction-indicator($column)}
                }

                { $sorted-keys }

};

(:
    Helper function: Callback function called used in indexes:show-index-keys() for util:index-keys()
:)
declare function indexes:term-callback($term as xs:string, $data as xs:int+) as element() {

        {$term}
        {$data[1]}
        {$data[2]}
        {$data[3]}

};

(:
    Analyzes the Lucene indexes in an index definition
:)
declare function indexes:analyze-lucene-indexes($xconf) {
    let $index-label := indexes:index-name-to-label('lucene-index')
    let $lucene := $xconf/cc:index/cc:lucene
    return if (not($lucene) or not($lucene/cc:text)) then () else
        (
        (: TODO: complete report of default/other Lucene analyzers :)
        (:let $analyzers := $lucene/cc:analyzer
        return
            if ($analyzers) then
                (

Lucene Analyzers

                ,
                for $node in $analyzers
                return
                    if (not($node/@id)) then

default: {concat(' ', $node/@class/string())}

                    else

{$node/@id/string()}: {concat(' ', $node/@class/string())}

                )
            else ()
        ,:)
        let $texts := $lucene//cc:text
        return
            (
            for $text in $texts
            let $qname := if ($text/@qname) then $text/@qname/string() else ()
            let $match := if ($text/@match) then $text/@match/string() else ()
            let $analyzer := if ($text/@analyzer) then $text/@analyzer/string() else ()
            let $collection := substring-after(util:collection-name($text), '/db/system/config')
            let $nodeset := if ($qname) then indexes:get-nodeset-from-qname($collection, $qname) else indexes:get-nodeset-from-match($collection, $match)
            return

                        {if ($qname) then $qname else $match}
                        {if ($text/@boost) then concat(' (boost: ', $text/@boost/string(), ')') else ()}
                        {if ($text/cc:ignore) then (
, concat('(ignore: ', string-join(for $ignore in $text/cc:ignore return $ignore/@qname/string(), ', '), ')')) else ()}
                    {$index-label} {if ($qname) then ' QName' else ' Match'} {if ($analyzer) then concat(' (', $analyzer, ')') else ' (default analyzer)' (: TODO: complete report of default/other Lucene analyzers :)}
                    {count($nodeset)}
                    {
                        if (empty($nodeset)) then ()
                        else
                            (
                            QName
                            ,
                            ', '
                            ,
                            Node
                            )
                    }

            )
        )
};

(:
    Analyzes the legacy fulltext indexes in an index definition
:)
declare function indexes:analyze-legacy-fulltext-indexes($xconf) {
    let $collection := substring-after(util:collection-name($xconf), '/db/system/config')
    let $index := 'legacy-fulltext-index'
    let $index-label := indexes:index-name-to-label($index)
    let $fulltext := $xconf/cc:index/cc:fulltext
    let $creates := $fulltext/cc:create
    let $default-none := $fulltext/@default eq 'none'
    let $attributes-none := $fulltext/@attributes eq 'false'

    let $no-fulltext := if ( not($fulltext) or ($default-none and $attributes-none and not($creates)) ) then '(disabled)' else ()
    return
        if ($no-fulltext) then ()
        else if (not($default-none) and not($attributes-none)) then

                All Elements and Attributes!
                {$index-label}
                {count(collection($collection)//*)} elements and {count(collection($collection)//@*)} attributes
                (Too many to display)

(: is it feasible to display all qnames/nodes here? :)
        else (: if ($creates) then :)
            (
            for $create in $creates
            let $qname := $create/@qname/string()
            let $mixed := $create/@mixed/string()
            return

                    {$qname}
                    {$index-label} {if ($mixed) then '(mixed)' else ()}
                    {count(util:eval(concat('collection(', $collection, ')//', $qname)))}
                    Node

            ,
            let $only-elements-disabled := if ($fulltext/@default eq 'none' and $fulltext/@attributes ne 'no') then '(elements disabled)' else ()
            let $only-attribs-disabled := if ($fulltext/@default ne 'none' and $fulltext/@attributes eq 'no') then '(attributes disabled)' else ()
            return
            if ($only-elements-disabled) then

                    All Attributes!
                    {$index-label}
                    {count(collection($collection)//@*)} attributes
                    (Too many to display)

(: is it feasible to display all qnames/nodes here? :)
            else if ($only-attribs-disabled) then

                    All Elements!
                    {$index-label}
                    {count(collection($collection)//*)} elements
                    (Too many to display)

(: is it feasible to display all qnames/nodes here? :)
            else ()
            )
};

(:
    Analyzes the range indexes in an index definition
:)
declare function indexes:analyze-range-indexes($xconf) {
    let $index-label := indexes:index-name-to-label('range-index')
    let $ranges := $xconf/cc:index/cc:create
    return if (not($ranges)) then () else
        for $range in $ranges
        let $qname := $range/@qname/string()
        let $match := $range/@path/string()
        let $type := $range/@type/string()
        let $collection := substring-after(util:collection-name($range), '/db/system/config')
        let $nodeset := if ($qname) then indexes:get-nodeset-from-qname($collection, $qname) else indexes:get-nodeset-from-match($collection, $match)
        return

                {if ($qname) then $qname else $match}
                {$index-label} {if ($qname) then ' QName' else ' Path'} ({$type})
                {count($nodeset)}
                {
                    if (empty($nodeset)) then ()
                    else
                        Node
                }

};

(:
    Analyzes the NGram indexes in an index definition
:)
declare function indexes:analyze-ngram-indexes($xconf) {
    let $index-label := indexes:index-name-to-label('ngram-index')
    let $ngrams := $xconf/cc:index/cc:ngram
    return if (not($ngrams)) then () else
        for $ngram in $ngrams
        let $qname := $ngram/@qname/string()
        let $collection := substring-after(util:collection-name($ngram), '/db/system/config')
        let $nodeset := indexes:get-nodeset-from-qname($collection, $qname)
        return

                {$qname}
                {$index-label} QName
                {count($nodeset)}
                {
                    if (not(empty($nodeset))) then
                        (
                        QName,
                        ', '
                        ,
                        Node
                        )
                     else ()
                 }

};

(:
    Helper function: Returns a nodeset of instances of a node-name in a collection
:)
declare function indexes:get-nodeset-from-qname($collection as xs:string, $node-name as xs:string) as node()* {
    let $nodeset-expression :=
        concat(
            indexes:get-namespace-decaration-from-node-name($node-name, $collection)
            ,
            'collection("', $collection, '")//', $node-name
        )
    let $log := util:log("DEBUG", concat("INDEXES get-nodeset:          ", $nodeset-expression))
    return
        util:eval($nodeset-expression)
};

(:
    Helper function: Returns a nodeset of instances of a match expression in a collection
:)
declare function indexes:get-nodeset-from-match($collection as xs:string, $match as xs:string) as node()* {
    let $nodeset-expression :=
        concat(
            string-join(
                let $node-names := tokenize(replace($match, '//', '/'), '/')
                return
                    for $node-name in $node-names
                    return
                        indexes:get-namespace-decaration-from-node-name($node-name, $collection)
                , ' ')
            ,
            'collection("', $collection, '")', $match, if (contains($match, '@')) then () else ()
        )
    return
        util:eval($nodeset-expression)
};

(:
    Helper function: Returns the index definition for a given collection
:)
declare function indexes:get-xconf($collection as xs:string) as document-node() {
    let $config-root := '/db/system/config'
    let $xconf-collection := concat($config-root, $collection)
    let $xconf-filename := xmldb:get-child-resources($xconf-collection)[ends-with(., '.xconf')]
    let $xconf := doc(concat($xconf-collection, '/', $xconf-filename))
    return $xconf
};

(:
    Helper function: Looks in the collection.xconf's collection and index elements for namespace URIs for a given node name
:)
declare function indexes:get-namespace-uri-from-node-name($node-name, $collection) {

    let $name := if (starts-with($node-name,'@')) then
                    substring-after( substring-before($node-name, ':'), '@' )
                else
                    substring-before($node-name, ':')

    let $xconf := indexes:get-xconf($collection)
    let $uri := (namespace-uri-for-prefix($name, $xconf/cc:collection), namespace-uri-for-prefix($name, $xconf//cc:index))
    return
        $uri
};

(:
    Helper function: Constructs a namespace declaration for use in util:eval()
:)
declare function indexes:get-namespace-decaration-from-node-name($node-name as xs:string, $collection as xs:string) as xs:string* {
    if (not(matches($node-name, 'xml:')) and contains($node-name, ':')) then

        let $name := if (starts-with($node-name,'@')) then
                        substring-after( substring-before($node-name, ':'), '@' )
                    else
                        substring-before($node-name, ':')

        let $uri := indexes:get-namespace-uri-from-node-name($node-name, $collection)
        return
            concat('declare namespace ', $name, '="', $uri, '"; ')
    else ()
};

(:
    Helper function: gets the label for a given index-name
:)
declare function indexes:index-name-to-label($index-name as xs:string) as xs:string {
    $indexes:index-names//item[value eq $index-name]/label/text()
};

(:
    ====
    Helper functions for modifying the sort order used in indexes:show-index-keys()
    ====
:)
declare function indexes:toggle-sortorder($current-sortorder) {
    indexes:toggle-sortorder($current-sortorder, ())
};

declare function indexes:toggle-sortorder($current-sortorder, $other-new-parameters) {
    let $neworder :=
        if ($current-sortorder eq 'ascending') then
            'sortorder=descending'
        else
            'sortorder=ascending'
    let $new-parameters := ($neworder, $other-new-parameters)
    return
        indexes:replace-parameters($new-parameters)
};

declare function indexes:set-sortorder($current-sortorder, $current-sortby, $new-sortby) {
    if ($current-sortby eq $new-sortby) then
        indexes:toggle-sortorder($current-sortorder)
    else
        indexes:strip-param-from-param-string(indexes:replace-parameters(concat('sortby=', $new-sortby)), 'sortorder')
};

declare function indexes:set-sortorder($new-sortby) {
    indexes:set-sortorder($indexes:sortorder, $indexes:sortby, $new-sortby)
};

declare function indexes:sort-direction-indicator($sortby as xs:string) {
    if ($sortby eq $indexes:sortby) then
        if ($indexes:sortorder eq 'ascending') then
            ' ↓'
        else
            ' ↑'
    else ()
};

(:
    ====
    Helper functions for handling parameters
    ====
:)
declare function indexes:remove-parameter-names($parameter-names-to-remove) {
    let $current-parameter-names := request:get-parameter-names()
    let $remaining-parameters :=
        indexes:remove-parameter-names(
            for $current-parameter-name in $current-parameter-names
            return
                concat($current-parameter-name, '=', request:get-parameter( $current-parameter-name, () ))
            ,
            $parameter-names-to-remove
            )
    return
        if (exists($remaining-parameters)) then
            concat('?', string-join($remaining-parameters, '&'))
        else
            '?'
};

declare function indexes:remove-parameter-names($current-parameters, $parameter-names-to-remove) {
    for $current-parameter in $current-parameters
    return
        if (substring-before($current-parameter, '=') = $parameter-names-to-remove) then
            ()
        else
            $current-parameter
};

declare function indexes:remove-parameter-names-except($parameter-names-to-keep) {
    let $current-parameter-names := request:get-parameter-names()
    return
        indexes:remove-parameter-names($current-parameter-names[not(. = $parameter-names-to-keep)])
};

declare function indexes:replace-parameters($new-parameters) {
    let $current-parameter-names := request:get-parameter-names()
    let $current-parameters :=
        for $name in $current-parameter-names
        return concat($name, '=', request:get-parameter($name, ()))
    return
        indexes:replace-parameters($current-parameters, $new-parameters)
};

declare function indexes:replace-parameters($current-parameters, $new-parameters) {
    let $new-parameter-names := for $new-parameter in $new-parameters return substring-before($new-parameter, '=')
    let $remaining-parameters := indexes:remove-parameter-names($current-parameters, $new-parameter-names)
    let $result-parameters := for $param in ($remaining-parameters, $new-parameters) order by $param return $param
    return
        concat('?', string-join($result-parameters, '&'))
};

declare function indexes:strip-param-from-param-string($param-string, $param) {
    replace($param-string, concat('&?', $param, '=[^&]*?&?.*$'), '')
};


fix for errors.xq in CTESTs

fix for errors.xq in CTESTs

(:
 : Copyright 2006-2011 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.
 :)

 (:
  : THIS FILE IS GENERATED.
  : PLEASE DO NOT EDIT.
  :)
 (:~
 : This module contains one declaration of a variable for each
 : error of the http://www.zorba-xquery.com/errors namespace.
 : The variables serves as documentation for the errors but can also
 : be used in the code. For example, one useful scenario is to compare
 : an error caught in the catch clause of a try-catch expression with one of
 : the variables.
 :
 : @author Carlos Lopez
 :
 : @project error
 :)

xquery version '1.0';

module namespace zerr = 'http://www.zorba-xquery.com/errors';

declare variable $zerr:NS := 'http://www.zorba-xquery.com/errors';

(:~
 :
 : An "error" constant for "no error."
 :
:)
declare variable $zerr:ZXQP0000 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0000");

(:~
:)
declare variable $zerr:ZXQP0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0001");

(:~
 :
 : A Zorba programming assertion failed.  If this error occurs, it is a bug
 : and should be reported.
 :
:)
declare variable $zerr:ZXQP0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0002");

(:~
 :
 : Something unexpected occurred in Zorba.  If this error occurs, it is a
 : bug and should be reported.
 :
:)
declare variable $zerr:ZXQP0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0003");

(:~
 :
 : A particular XQuery feature has not been implemented by Zorba.
 :
:)
declare variable $zerr:ZXQP0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0004");

(:~
 :
 : A particular XQuery feature has been implemented by Zorba, but the
 : feature has not been enabled in the current build.
 :
:)
declare variable $zerr:ZXQP0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0005");

(:~
:)
declare variable $zerr:ZXQP0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0006");

(:~
:)
declare variable $zerr:ZXQP0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0007");

(:~
:)
declare variable $zerr:ZXQP0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0008");

(:~
:)
declare variable $zerr:ZXQP0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0009");

(:~
:)
declare variable $zerr:ZXQP0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0010");

(:~
:)
declare variable $zerr:ZXQP0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0013");

(:~
:)
declare variable $zerr:ZXQP0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0016");

(:~
:)
declare variable $zerr:ZXQP0017 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0017");

(:~
:)
declare variable $zerr:ZXQP0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0020");

(:~
:)
declare variable $zerr:ZXQP0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0021");

(:~
:)
declare variable $zerr:ZXQP0024 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0024");

(:~
:)
declare variable $zerr:ZXQP0025 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0025");

(:~
:)
declare variable $zerr:ZXQP0026 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0026");

(:~
:)
declare variable $zerr:ZXQP0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0028");

(:~
:)
declare variable $zerr:ZXQP0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0029");

(:~
:)
declare variable $zerr:ZXQP0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0030");

(:~
:)
declare variable $zerr:ZXQP0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0031");

(:~
:)
declare variable $zerr:ZXQP0032 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0032");

(:~
:)
declare variable $zerr:ZXQP0036 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0036");

(:~
:)
declare variable $zerr:ZXQP0037 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0037");

(:~
:)
declare variable $zerr:ZXQP0038 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0038");

(:~
:)
declare variable $zerr:ZXQP0039 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0039");

(:~
:)
declare variable $zerr:ZXQP0040 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0040");

(:~
:)
declare variable $zerr:ZXQP0050 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0050");

(:~
:)
declare variable $zerr:ZXQP0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0060");

(:~
 :
 : The version of the thesaurus is not the expected version.
 :
:)
declare variable $zerr:ZXQP8401 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP8401");

(:~
 :
 :
:)
declare variable $zerr:ZXQP8402 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP8402");

(:~
 :
 : The thesaurus data contains an unexpected value.
 :
:)
declare variable $zerr:ZXQP8403 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP8403");

(:~
:)
declare variable $zerr:ZXQD0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0001");

(:~
:)
declare variable $zerr:ZXQD0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0002");

(:~
:)
declare variable $zerr:ZXQD0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0003");

(:~
:)
declare variable $zerr:ZXQD0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0004");

(:~
:)
declare variable $zerr:ZXQD0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0005");

(:~
:)
declare variable $zerr:ZXQD0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0006");

(:~
:)
declare variable $zerr:ZAPI0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0002");

(:~
:)
declare variable $zerr:ZAPI0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0003");

(:~
:)
declare variable $zerr:ZAPI0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0004");

(:~
:)
declare variable $zerr:ZAPI0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0005");

(:~
:)
declare variable $zerr:ZAPI0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0006");

(:~
:)
declare variable $zerr:ZAPI0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0007");

(:~
:)
declare variable $zerr:ZAPI0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0008");

(:~
:)
declare variable $zerr:ZAPI0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0009");

(:~
:)
declare variable $zerr:ZAPI0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0011");

(:~
:)
declare variable $zerr:ZAPI0014 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0014");

(:~
:)
declare variable $zerr:ZAPI0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0015");

(:~
:)
declare variable $zerr:ZAPI0019 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0019");

(:~
:)
declare variable $zerr:ZAPI0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0020");

(:~
:)
declare variable $zerr:ZAPI0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0021");

(:~
:)
declare variable $zerr:ZAPI0027 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0027");

(:~
:)
declare variable $zerr:ZAPI0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0028");

(:~
:)
declare variable $zerr:ZAPI0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0029");

(:~
:)
declare variable $zerr:ZAPI0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0030");

(:~
:)
declare variable $zerr:ZAPI0039 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0039");

(:~
:)
declare variable $zerr:ZAPI0040 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0040");

(:~
:)
declare variable $zerr:ZAPI0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0041");

(:~
:)
declare variable $zerr:ZAPI0042 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0042");

(:~
:)
declare variable $zerr:ZAPI0070 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0070");

(:~
:)
declare variable $zerr:ZAPI0080 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0080");

(:~
:)
declare variable $zerr:ZAPI0090 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0090");

(:~
:)
declare variable $zerr:ZCSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0001");

(:~
:)
declare variable $zerr:ZCSE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0002");

(:~
:)
declare variable $zerr:ZCSE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0003");

(:~
:)
declare variable $zerr:ZCSE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0004");

(:~
:)
declare variable $zerr:ZCSE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0005");

(:~
:)
declare variable $zerr:ZCSE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0006");

(:~
:)
declare variable $zerr:ZCSE0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0007");

(:~
:)
declare variable $zerr:ZCSE0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0008");

(:~
:)
declare variable $zerr:ZCSE0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0009");

(:~
:)
declare variable $zerr:ZCSE0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0010");

(:~
:)
declare variable $zerr:ZCSE0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0011");

(:~
:)
declare variable $zerr:ZCSE0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0012");

(:~
:)
declare variable $zerr:ZCSE0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0013");

(:~
:)
declare variable $zerr:ZCSE0014 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0014");

(:~
:)
declare variable $zerr:ZCSE0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0015");

(:~
:)
declare variable $zerr:ZCSE0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0016");

(:~
:)
declare variable $zerr:ZCSE0017 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0017");

(:~
:)
declare variable $zerr:ZDDY0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0001");

(:~
:)
declare variable $zerr:ZDDY0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0002");

(:~
:)
declare variable $zerr:ZDDY0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0003");

(:~
:)
declare variable $zerr:ZDDY0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0004");

(:~
:)
declare variable $zerr:ZDDY0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0005");

(:~
:)
declare variable $zerr:ZDDY0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0006");

(:~
:)
declare variable $zerr:ZDDY0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0007");

(:~
:)
declare variable $zerr:ZDDY0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0008");

(:~
:)
declare variable $zerr:ZDDY0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0009");

(:~
:)
declare variable $zerr:ZDDY0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0010");

(:~
:)
declare variable $zerr:ZDDY0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0011");

(:~
:)
declare variable $zerr:ZDDY0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0012");

(:~
:)
declare variable $zerr:ZDDY0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0013");

(:~
:)
declare variable $zerr:ZDDY0014 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0014");

(:~
:)
declare variable $zerr:ZDDY0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0015");

(:~
:)
declare variable $zerr:ZDDY0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0016");

(:~
:)
declare variable $zerr:ZDDY0017 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0017");

(:~
:)
declare variable $zerr:ZDDY0018 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0018");

(:~
:)
declare variable $zerr:ZDDY0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0020");

(:~
:)
declare variable $zerr:ZDDY0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0021");

(:~
:)
declare variable $zerr:ZDDY0022 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0022");

(:~
:)
declare variable $zerr:ZDDY0023 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0023");

(:~
:)
declare variable $zerr:ZDDY0024 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0024");

(:~
:)
declare variable $zerr:ZDDY0025 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0025");

(:~
:)
declare variable $zerr:ZDDY0026 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0026");

(:~
:)
declare variable $zerr:ZDDY0027 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0027");

(:~
:)
declare variable $zerr:ZDDY0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0028");

(:~
:)
declare variable $zerr:ZDDY0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0029");

(:~
:)
declare variable $zerr:ZDDY0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0030");

(:~
:)
declare variable $zerr:ZDDY0034 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0034");

(:~
:)
declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0035");

(:~
:)
declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0031");

(:~
:)
declare variable $zerr:ZDDY0032 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0032");

(:~
:)
declare variable $zerr:ZDDY0033 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0033");

(:~
:)
declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");

(:~
:)
declare variable $zerr:ZDST0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0002");

(:~
:)
declare variable $zerr:ZDST0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0003");

(:~
:)
declare variable $zerr:ZDST0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0004");

(:~
:)
declare variable $zerr:ZDST0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0006");

(:~
:)
declare variable $zerr:ZDST0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0007");

(:~
:)
declare variable $zerr:ZDST0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0021");

(:~
:)
declare variable $zerr:ZDST0022 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0022");

(:~
:)
declare variable $zerr:ZDST0023 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0023");

(:~
:)
declare variable $zerr:ZDST0024 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0024");

(:~
:)
declare variable $zerr:ZDST0025 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0025");

(:~
:)
declare variable $zerr:ZDST0026 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0026");

(:~
:)
declare variable $zerr:ZDST0027 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0027");

(:~
:)
declare variable $zerr:ZDST0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0028");

(:~
:)
declare variable $zerr:ZDST0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0029");

(:~
:)
declare variable $zerr:ZDST0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0030");

(:~
:)
declare variable $zerr:ZDST0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0031");

(:~
:)
declare variable $zerr:ZDST0032 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0032");

(:~
:)
declare variable $zerr:ZDST0033 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0033");

(:~
:)
declare variable $zerr:ZDST0034 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0034");

(:~
:)
declare variable $zerr:ZDST0035 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0035");

(:~
:)
declare variable $zerr:ZDST0036 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0036");

(:~
:)
declare variable $zerr:ZDST0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0041");

(:~
:)
declare variable $zerr:ZDST0044 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0044");

(:~
:)
declare variable $zerr:ZDST0048 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0048");

(:~
:)
declare variable $zerr:ZDST0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0060");

(:~
:)
declare variable $zerr:ZDTY0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0001");

(:~
:)
declare variable $zerr:ZDTY0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0010");

(:~
:)
declare variable $zerr:ZDTY0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0011");

(:~
:)
declare variable $zerr:ZDTY0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0012");

declare variable $zerr:ZGDB0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZGDB0001");

(:~
:)
declare variable $zerr:ZOSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0001");

(:~
:)
declare variable $zerr:ZOSE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0002");

(:~
:)
declare variable $zerr:ZOSE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0003");

(:~
:)
declare variable $zerr:ZOSE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0004");

(:~
:)
declare variable $zerr:ZOSE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0005");

(:~
:)
declare variable $zerr:ZOSE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0006");

(:~
:)
declare variable $zerr:ZSTR0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0001");

(:~
:)
declare variable $zerr:ZSTR0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0002");

(:~
:)
declare variable $zerr:ZSTR0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0003");

(:~
:)
declare variable $zerr:ZSTR0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0004");

(:~
:)
declare variable $zerr:ZSTR0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0007");

(:~
:)
declare variable $zerr:ZSTR0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0008");

(:~
:)
declare variable $zerr:ZSTR0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0009");

(:~
:)
declare variable $zerr:ZSTR0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0010");

(:~
:)
declare variable $zerr:ZSTR0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0011");

(:~
:)
declare variable $zerr:ZSTR0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0012");

(:~
:)
declare variable $zerr:ZSTR0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0015");

(:~
:)
declare variable $zerr:ZSTR0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0016");

(:~
:)
declare variable $zerr:ZSTR0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0020");

(:~
:)
declare variable $zerr:ZSTR0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0021");

(:~
:)
declare variable $zerr:ZSTR0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0030");

(:~
:)
declare variable $zerr:ZSTR0040 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0040");

(:~
:)
declare variable $zerr:ZSTR0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0041");

(:~
:)
declare variable $zerr:ZSTR0045 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0045");

(:~
:)
declare variable $zerr:ZSTR0050 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0050");

(:~
:)
declare variable $zerr:ZSTR0055 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0055");

(:~
:)
declare variable $zerr:ZSTR0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0060");

(:~
:)
declare variable $zerr:ZSTR0065 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0065");

(:~
:)
declare variable $zerr:XSST0001 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0001");

(:~
:)
declare variable $zerr:XSST0002 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0002");

(:~
:)
declare variable $zerr:XSST0003 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0003");

(:~
:)
declare variable $zerr:XSST0004 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0004");

(:~
:)
declare variable $zerr:XSST0005 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0005");

(:~
:)
declare variable $zerr:XSST0006 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0006");

(:~
:)
declare variable $zerr:XSST0007 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0007");

(:~
:)
declare variable $zerr:XSST0008 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0008");

(:~
:)
declare variable $zerr:XSST0009 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0009");

(:~
:)
declare variable $zerr:XSST0010 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0010");

(:~
:)
declare variable $zerr:ZJPE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0001");

(:~
:)
declare variable $zerr:ZJPE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0002");

(:~
:)
declare variable $zerr:ZJPE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0003");

(:~
:)
declare variable $zerr:ZJPE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0004");

(:~
:)
declare variable $zerr:ZJPE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0005");

(:~
:)
declare variable $zerr:ZJPE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0006");

(:~
:)
declare variable $zerr:ZJPE0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0007");

(:~
:)
declare variable $zerr:ZJPE0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0008");

(:~
:)
declare variable $zerr:ZJPE0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0009");

(:~
:)
declare variable $zerr:ZJSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0001");

(:~
:)
declare variable $zerr:ZJSE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0002");

(:~
:)
declare variable $zerr:ZJSE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0003");

(:~
:)
declare variable $zerr:ZJSE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0004");

(:~
:)
declare variable $zerr:ZJSE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0005");

(:~
:)
declare variable $zerr:ZJSE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0006");

(:~
:)
declare variable $zerr:ZJSE0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0007");

(:~
:)
declare variable $zerr:ZJSE0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0008");

(:
 : Copyright 2006-2011 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.
 :)

 (:
  : THIS FILE IS GENERATED.
  : PLEASE DO NOT EDIT.
  :)
 (:~
 : This module contains one declaration of a variable for each
 : error of the http://www.zorba-xquery.com/errors namespace.
 : The variables serves as documentation for the errors but can also
 : be used in the code. For example, one useful scenario is to compare
 : an error caught in the catch clause of a try-catch expression with one of
 : the variables.
 :
 : @author Carlos Lopez
 :
 : @project error
 :)

xquery version '1.0';

module namespace zerr = 'http://www.zorba-xquery.com/errors';

declare variable $zerr:NS := 'http://www.zorba-xquery.com/errors';

(:~
 :
 : An "error" constant for "no error."
 :
:)
declare variable $zerr:ZXQP0000 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0000");

(:~
:)
declare variable $zerr:ZXQP0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0001");

(:~
 :
 : A Zorba programming assertion failed.  If this error occurs, it is a bug
 : and should be reported.
 :
:)
declare variable $zerr:ZXQP0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0002");

(:~
 :
 : Something unexpected occurred in Zorba.  If this error occurs, it is a
 : bug and should be reported.
 :
:)
declare variable $zerr:ZXQP0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0003");

(:~
 :
 : A particular XQuery feature has not been implemented by Zorba.
 :
:)
declare variable $zerr:ZXQP0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0004");

(:~
 :
 : A particular XQuery feature has been implemented by Zorba, but the
 : feature has not been enabled in the current build.
 :
:)
declare variable $zerr:ZXQP0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0005");

(:~
:)
declare variable $zerr:ZXQP0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0006");

(:~
:)
declare variable $zerr:ZXQP0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0007");

(:~
:)
declare variable $zerr:ZXQP0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0008");

(:~
:)
declare variable $zerr:ZXQP0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0009");

(:~
:)
declare variable $zerr:ZXQP0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0010");

(:~
:)
declare variable $zerr:ZXQP0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0013");

(:~
:)
declare variable $zerr:ZXQP0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0016");

(:~
:)
declare variable $zerr:ZXQP0017 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0017");

(:~
:)
declare variable $zerr:ZXQP0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0020");

(:~
:)
declare variable $zerr:ZXQP0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0021");

(:~
:)
declare variable $zerr:ZXQP0024 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0024");

(:~
:)
declare variable $zerr:ZXQP0025 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0025");

(:~
:)
declare variable $zerr:ZXQP0026 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0026");

(:~
:)
declare variable $zerr:ZXQP0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0028");

(:~
:)
declare variable $zerr:ZXQP0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0029");

(:~
:)
declare variable $zerr:ZXQP0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0030");

(:~
:)
declare variable $zerr:ZXQP0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0031");

(:~
:)
declare variable $zerr:ZXQP0032 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0032");

(:~
:)
declare variable $zerr:ZXQP0036 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0036");

(:~
:)
declare variable $zerr:ZXQP0037 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0037");

(:~
:)
declare variable $zerr:ZXQP0038 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0038");

(:~
:)
declare variable $zerr:ZXQP0039 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0039");

(:~
:)
declare variable $zerr:ZXQP0040 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0040");

(:~
:)
declare variable $zerr:ZXQP0050 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0050");

(:~
:)
declare variable $zerr:ZXQP0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0060");

(:~
 :
 : The version of the thesaurus is not the expected version.
 :
:)
declare variable $zerr:ZXQP8401 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP8401");

(:~
 :
 :
:)
declare variable $zerr:ZXQP8402 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP8402");

(:~
 :
 : The thesaurus data contains an unexpected value.
 :
:)
declare variable $zerr:ZXQP8403 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP8403");

(:~
:)
declare variable $zerr:ZXQD0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0001");

(:~
:)
declare variable $zerr:ZXQD0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0002");

(:~
:)
declare variable $zerr:ZXQD0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0003");

(:~
:)
declare variable $zerr:ZXQD0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0004");

(:~
:)
declare variable $zerr:ZXQD0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0005");

(:~
:)
declare variable $zerr:ZXQD0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQD0006");

(:~
:)
declare variable $zerr:ZAPI0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0002");

(:~
:)
declare variable $zerr:ZAPI0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0003");

(:~
:)
declare variable $zerr:ZAPI0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0004");

(:~
:)
declare variable $zerr:ZAPI0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0005");

(:~
:)
declare variable $zerr:ZAPI0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0006");

(:~
:)
declare variable $zerr:ZAPI0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0007");

(:~
:)
declare variable $zerr:ZAPI0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0008");

(:~
:)
declare variable $zerr:ZAPI0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0009");

(:~
:)
declare variable $zerr:ZAPI0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0011");

(:~
:)
declare variable $zerr:ZAPI0014 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0014");

(:~
:)
declare variable $zerr:ZAPI0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0015");

(:~
:)
declare variable $zerr:ZAPI0019 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0019");

(:~
:)
declare variable $zerr:ZAPI0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0020");

(:~
:)
declare variable $zerr:ZAPI0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0021");

(:~
:)
declare variable $zerr:ZAPI0027 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0027");

(:~
:)
declare variable $zerr:ZAPI0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0028");

(:~
:)
declare variable $zerr:ZAPI0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0029");

(:~
:)
declare variable $zerr:ZAPI0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0030");

(:~
:)
declare variable $zerr:ZAPI0039 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0039");

(:~
:)
declare variable $zerr:ZAPI0040 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0040");

(:~
:)
declare variable $zerr:ZAPI0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0041");

(:~
:)
declare variable $zerr:ZAPI0042 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0042");

(:~
:)
declare variable $zerr:ZAPI0070 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0070");

(:~
:)
declare variable $zerr:ZAPI0080 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0080");

(:~
:)
declare variable $zerr:ZAPI0090 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0090");

(:~
:)
declare variable $zerr:ZCSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0001");

(:~
:)
declare variable $zerr:ZCSE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0002");

(:~
:)
declare variable $zerr:ZCSE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0003");

(:~
:)
declare variable $zerr:ZCSE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0004");

(:~
:)
declare variable $zerr:ZCSE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0005");

(:~
:)
declare variable $zerr:ZCSE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0006");

(:~
:)
declare variable $zerr:ZCSE0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0007");

(:~
:)
declare variable $zerr:ZCSE0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0008");

(:~
:)
declare variable $zerr:ZCSE0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0009");

(:~
:)
declare variable $zerr:ZCSE0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0010");

(:~
:)
declare variable $zerr:ZCSE0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0011");

(:~
:)
declare variable $zerr:ZCSE0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0012");

(:~
:)
declare variable $zerr:ZCSE0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0013");

(:~
:)
declare variable $zerr:ZCSE0014 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0014");

(:~
:)
declare variable $zerr:ZCSE0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0015");

(:~
:)
declare variable $zerr:ZCSE0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0016");

(:~
:)
declare variable $zerr:ZCSE0017 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0017");

(:~
:)
declare variable $zerr:ZDDY0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0001");

(:~
:)
declare variable $zerr:ZDDY0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0002");

(:~
:)
declare variable $zerr:ZDDY0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0003");

(:~
:)
declare variable $zerr:ZDDY0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0004");

(:~
:)
declare variable $zerr:ZDDY0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0005");

(:~
:)
declare variable $zerr:ZDDY0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0006");

(:~
:)
declare variable $zerr:ZDDY0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0007");

(:~
:)
declare variable $zerr:ZDDY0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0008");

(:~
:)
declare variable $zerr:ZDDY0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0009");

(:~
:)
declare variable $zerr:ZDDY0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0010");

(:~
:)
declare variable $zerr:ZDDY0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0011");

(:~
:)
declare variable $zerr:ZDDY0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0012");

(:~
:)
declare variable $zerr:ZDDY0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0013");

(:~
:)
declare variable $zerr:ZDDY0014 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0014");

(:~
:)
declare variable $zerr:ZDDY0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0015");

(:~
:)
declare variable $zerr:ZDDY0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0016");

(:~
:)
declare variable $zerr:ZDDY0017 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0017");

(:~
:)
declare variable $zerr:ZDDY0018 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0018");

(:~
:)
declare variable $zerr:ZDDY0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0020");

(:~
:)
declare variable $zerr:ZDDY0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0021");

(:~
:)
declare variable $zerr:ZDDY0022 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0022");

(:~
:)
declare variable $zerr:ZDDY0023 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0023");

(:~
:)
declare variable $zerr:ZDDY0024 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0024");

(:~
:)
declare variable $zerr:ZDDY0025 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0025");

(:~
:)
declare variable $zerr:ZDDY0026 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0026");

(:~
:)
declare variable $zerr:ZDDY0027 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0027");

(:~
:)
declare variable $zerr:ZDDY0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0028");

(:~
:)
declare variable $zerr:ZDDY0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0029");

(:~
:)
declare variable $zerr:ZDDY0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0030");

(:~
:)
declare variable $zerr:ZDDY0034 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0034");

(:~
:)
declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0035");

(:~
:)
declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0031");

(:~
:)
declare variable $zerr:ZDDY0032 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0032");

(:~
:)
declare variable $zerr:ZDDY0033 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0033");

(:~
:)
declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");

(:~
:)
declare variable $zerr:ZDST0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0002");

(:~
:)
declare variable $zerr:ZDST0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0003");

(:~
:)
declare variable $zerr:ZDST0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0004");

(:~
:)
declare variable $zerr:ZDST0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0006");

(:~
:)
declare variable $zerr:ZDST0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0007");

(:~
:)
declare variable $zerr:ZDST0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0021");

(:~
:)
declare variable $zerr:ZDST0022 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0022");

(:~
:)
declare variable $zerr:ZDST0023 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0023");

(:~
:)
declare variable $zerr:ZDST0024 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0024");

(:~
:)
declare variable $zerr:ZDST0025 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0025");

(:~
:)
declare variable $zerr:ZDST0026 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0026");

(:~
:)
declare variable $zerr:ZDST0027 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0027");

(:~
:)
declare variable $zerr:ZDST0028 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0028");

(:~
:)
declare variable $zerr:ZDST0029 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0029");

(:~
:)
declare variable $zerr:ZDST0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0030");

(:~
:)
declare variable $zerr:ZDST0031 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0031");

(:~
:)
declare variable $zerr:ZDST0032 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0032");

(:~
:)
declare variable $zerr:ZDST0033 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0033");

(:~
:)
declare variable $zerr:ZDST0034 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0034");

(:~
:)
declare variable $zerr:ZDST0035 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0035");

(:~
:)
declare variable $zerr:ZDST0036 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0036");

(:~
:)
declare variable $zerr:ZDST0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0041");

(:~
:)
declare variable $zerr:ZDST0044 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0044");

(:~
:)
declare variable $zerr:ZDST0048 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0048");

(:~
:)
declare variable $zerr:ZDST0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0060");

(:~
:)
declare variable $zerr:ZDTY0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0001");

(:~
:)
declare variable $zerr:ZDTY0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0010");

(:~
:)
declare variable $zerr:ZDTY0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0011");

(:~
:)
declare variable $zerr:ZDTY0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZDTY0012");

declare variable $zerr:ZGDB0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZGDB0001");

(:~
:)
declare variable $zerr:ZOSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0001");

(:~
:)
declare variable $zerr:ZOSE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0002");

(:~
:)
declare variable $zerr:ZOSE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0003");

(:~
:)
declare variable $zerr:ZOSE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0004");

(:~
:)
declare variable $zerr:ZOSE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0005");

(:~
:)
declare variable $zerr:ZOSE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZOSE0006");

(:~
:)
declare variable $zerr:ZSTR0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0001");

(:~
:)
declare variable $zerr:ZSTR0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0002");

(:~
:)
declare variable $zerr:ZSTR0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0003");

(:~
:)
declare variable $zerr:ZSTR0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0004");

(:~
:)
declare variable $zerr:ZSTR0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0007");

(:~
:)
declare variable $zerr:ZSTR0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0008");

(:~
:)
declare variable $zerr:ZSTR0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0009");

(:~
:)
declare variable $zerr:ZSTR0010 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0010");

(:~
:)
declare variable $zerr:ZSTR0011 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0011");

(:~
:)
declare variable $zerr:ZSTR0012 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0012");

(:~
:)
declare variable $zerr:ZSTR0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0015");

(:~
:)
declare variable $zerr:ZSTR0016 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0016");

(:~
:)
declare variable $zerr:ZSTR0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0020");

(:~
:)
declare variable $zerr:ZSTR0021 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0021");

(:~
:)
declare variable $zerr:ZSTR0030 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0030");

(:~
:)
declare variable $zerr:ZSTR0040 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0040");

(:~
:)
declare variable $zerr:ZSTR0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0041");

(:~
:)
declare variable $zerr:ZSTR0045 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0045");

(:~
:)
declare variable $zerr:ZSTR0050 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0050");

(:~
:)
declare variable $zerr:ZSTR0055 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0055");

(:~
:)
declare variable $zerr:ZSTR0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0060");

(:~
:)
declare variable $zerr:XSST0001 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0001");

(:~
:)
declare variable $zerr:XSST0002 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0002");

(:~
:)
declare variable $zerr:XSST0003 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0003");

(:~
:)
declare variable $zerr:XSST0004 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0004");

(:~
:)
declare variable $zerr:XSST0005 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0005");

(:~
:)
declare variable $zerr:XSST0006 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0006");

(:~
:)
declare variable $zerr:XSST0007 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0007");

(:~
:)
declare variable $zerr:XSST0008 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0008");

(:~
:)
declare variable $zerr:XSST0009 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0009");

(:~
:)
declare variable $zerr:XSST0010 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0010");

(:~
:)
declare variable $zerr:ZJPE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0001");

(:~
:)
declare variable $zerr:ZJPE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0002");

(:~
:)
declare variable $zerr:ZJPE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0003");

(:~
:)
declare variable $zerr:ZJPE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0004");

(:~
:)
declare variable $zerr:ZJPE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0005");

(:~
:)
declare variable $zerr:ZJPE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0006");

(:~
:)
declare variable $zerr:ZJPE0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0007");

(:~
:)
declare variable $zerr:ZJPE0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0008");

(:~
:)
declare variable $zerr:ZJPE0009 as xs:QName := fn:QName($zerr:NS, "zerr:ZJPE0009");

(:~
:)
declare variable $zerr:ZJSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0001");

(:~
:)
declare variable $zerr:ZJSE0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0002");

(:~
:)
declare variable $zerr:ZJSE0003 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0003");

(:~
:)
declare variable $zerr:ZJSE0004 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0004");

(:~
:)
declare variable $zerr:ZJSE0005 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0005");

(:~
:)
declare variable $zerr:ZJSE0006 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0006");

(:~
:)
declare variable $zerr:ZJSE0007 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0007");

(:~
:)
declare variable $zerr:ZJSE0008 as xs:QName := fn:QName($zerr:NS, "zerr:ZJSE0008");