Chapter 11. TAN variables, keys, functions, and templates

Table of Contents

TAN-core global variables, keys, and functions summarized
variables
keys
functions
TAN-core-errors global variables, keys, and functions summarized
variables
functions
TAN-class-1 global variables, keys, and functions summarized
variables
functions
TAN-class-2 global variables, keys, and functions summarized
variables
keys
functions
templates
TAN-A-div global variables, keys, and functions summarized
variables
functions
TAN-A-tok global variables, keys, and functions summarized
functions
TAN-LM global variables, keys, and functions summarized
variables
functions
TAN-class-2-errors global variables, keys, and functions summarized
functions
TAN-class-1-and-2 global variables, keys, and functions summarized
variables
functions
TAN-key global variables, keys, and functions summarized
variables
TAN-class-2-and-3 global variables, keys, and functions summarized
functions
diff-for-xslt2 global variables, keys, and functions summarized
functions
regex-ext-tan global variables, keys, and functions summarized
variables
functions
templates
TAN-schema global variables, keys, and functions summarized
variables
functions
Mode templates
ŧ #all
ŧ add-lm-to-tok
ŧ add-square-brackets
ŧ add-tok-val
ŧ analysis-stamp
ŧ analyze-ref
ŧ arabic-numerals
ŧ c1-add-ref
ŧ c1-stamp-string-length
ŧ c1-stamp-string-pos
ŧ char-setup
ŧ class-1-copy-errors
ŧ class-1-errors
ŧ class-2-errors
ŧ compare-copies
ŧ convert-code-to-features
ŧ copy-of-except
ŧ core-attribute-errors
ŧ core-errors
ŧ count-tokenized-class-1
ŧ count-tokens
ŧ cull-prepped-class-1
ŧ diff-rectify
ŧ drop-tokenization
ŧ expand-lm
ŧ first-stamp
ŧ fragment-to-text
ŧ get-div-hierarchy-fragment
ŧ get-mismatched-text
ŧ include
ŧ infuse-tokenized-div
ŧ infuse-tokenized-text
ŧ insert-seg-into-leaf-divs-in-hierarchy-fragment
ŧ mark-splits
ŧ mark-splits-in-fragment
ŧ mark-tok-chars
ŧ normalize-space
ŧ pick-prepped-class-1
ŧ pluck
ŧ prep-class-1
ŧ prep-class-2-doc-pass-1
ŧ prep-class-2-doc-pass-2
ŧ prep-class-2-doc-pass-3
ŧ prep-class-2-doc-pass-3-old
ŧ prep-class-2-doc-pass-4
ŧ prep-rim-pass-1
ŧ prep-rim-pass-2
ŧ prep-srcs-verbosely
ŧ prep-tan-a-div-pass-3-prelim
ŧ prep-tan-a-div-pass-a
ŧ prep-tan-a-div-pass-b
ŧ prep-tan-claims
ŧ prep-tan-key
ŧ prep-tan-lm
ŧ prep-tan-mor
ŧ prep-verbosely
ŧ prepare-class-1-doc-for-merge
ŧ prepend-id-or-idrefs
ŧ process-splits
ŧ realign-tan-a-div-sources
ŧ referenced-doc-errors
ŧ resolve-attr-include
ŧ resolve-href
ŧ resolve-keyword
ŧ segment-tokd-prepped-class-1
ŧ snap-to-word-pass-1
ŧ split-marked-fragment
ŧ stamp-element-id
ŧ strip-all-attributes-except
ŧ strip-duplicates
ŧ strip-specific-attributes
ŧ strip-text
ŧ synthesize-merged-sources
ŧ TAN-A-div-errors
ŧ tan-a-div-merge-pass1
ŧ tan-key-errors
ŧ tokenize-prepped-class-1
ŧ unconsolidate-anas
Cross-format global variables
$self-and-sources-prepped
$self-prepped
$sources-prepped
Cross-format functions
tan:prep-resolved-class-1-doc()

The 93 global variables, 3 keys, 161 functions, and 80 templates (Ŧ = named template; ŧ = template mode) defined in the TAN function library, are the following (ʞ = key):

ŧ #all

tan:aaa-to-int() ŧ add-lm-to-tok ŧ add-square-brackets tan:add-tok-val() ŧ add-tok-val $all-body-iris $all-function-uses-of-error $all-functions $all-ids $all-iris $all-keywords tan:all-morph-codes() $all-schema-uses-of-error $all-schemas $alphabet-numeral-key tan:ana-grouping-key() ŧ analysis-stamp tan:analyze-elements-with-numeral-attributes() tan:analyze-ref() ŧ analyze-ref tan:analyze-stats() tan:analyze-string-length() tan:analyze-tok-chars() $apos tan:arabic-numerals() ŧ arabic-numerals

tan:base-uri() tan:batch-replace() $body

ŧ c1-add-ref ŧ c1-stamp-string-length ŧ c1-stamp-string-pos tan:cfn() $char-reg-exp ŧ char-setup tan:chop-string() ŧ class-1-copy-errors ŧ class-1-errors ŧ class-2-errors tan:class-number() tan:compare-copies() ŧ compare-copies $contexts-resolved tan:convert-code-to-features() ŧ convert-code-to-features tan:convert-ref-to-div-fragment() tan:copy-of() tan:copy-of-except() ŧ copy-of-except ŧ core-attribute-errors ŧ core-errors ŧ count-tokenized-class-1 ŧ count-tokens tan:counts-to-firsts() tan:counts-to-lasts() ŧ cull-prepped-class-1 tan:cull-prepped-class-1-data()

tan:data-type-check() tan:dateTime-to-decimal() tan:dec-to-hex() tan:diff() tan:diff-core() tan:diff-core-draft() tan:diff-loop() ŧ diff-rectify tan:distinct-items() tan:div-to-div-transfer() ʞ div-via-ref') $doc-id $doc-namespace $doc-parent-directory $doc-uri ŧ drop-tokenization $duplicate-ids $duplicate-iris tan:duplicate-values()

tan:element-key() $elements-that-must-always-refer-to-tan-files $empty-doc $erroneously-looped-doc tan:error() tan:error-report() $errors $errors-not-used tan:escape() ŧ expand-lm tan:expand-m() tan:expand-per-lm() tan:expand-search() tan:expand-src-and-div-type-ref() tan:expand-tok()

tan:feature-test-check() tan:feature-test-to-groups() $features-grouped $features-prepped tan:first-loc-available() ŧ first-stamp tan:fix() tan:flatref() tan:fragment-to-text() ŧ fragment-to-text $function-error-ids

tan:get-1st-doc() tan:get-context-prepped() ŧ get-div-hierarchy-fragment tan:get-doc-hist() tan:get-lm-ids() tan:get-matching-lm-combos() tan:get-matching-ls-or-ms() ŧ get-mismatched-text tan:get-n-types() tan:get-parent-elements() tan:get-picked-srcs-id-refs() tan:get-ref-seq() tan:get-src-1st-da() tan:get-src-1st-da-analysis-stamped() tan:get-src-1st-da-chars-picked() tan:get-src-1st-da-resolved() tan:get-src-1st-da-segmented() tan:get-src-1st-da-statted() tan:get-src-1st-da-tokenized() tan:get-src-1st-da-with-lms() tan:get-src-skeleton() tan:get-toks() tan:get-ucd-decomp() tan:get-via-q-ref() tan:glossary() tan:grc-to-int() $greek-letter-numeral-pattern tan:group-adjacent-elements() tan:group-by-IRIs() tan:group-by-IRIs-loop() tan:group-tok-elements()

tan:has-relationship() $head tan:help() tan:help-or-info() tan:help-requested() $help-trigger-regex $hex-key tan:hex-to-dec()

$id-idrefs tan:idrefs() tan:idrefs-loop() ŧ include $inclusions-1st-da $inclusions-resolved tan:info() ŧ infuse-tokenized-div ŧ infuse-tokenized-text ŧ insert-seg-into-leaf-divs-in-hierarchy-fragment tan:interpret-n-vals() ʞ item-via-node-name')

$keys-1st-da $keys-prepped $keys-resolved

$l-grouping-key-key $latin-letter-numeral-pattern tan:letter-to-number()

$m-grouping-key-key tan:mark-splits() ŧ mark-splits ŧ mark-splits-in-fragment ŧ mark-tok-chars tan:matches() tan:max-integer() tan:median() tan:merge-analyzed-stats() Ŧ merge-nodes tan:merge-source-loop() tan:merge-sources() tan:merge-tan-a-div-prepped() tan:min-last() $morphologies-prepped tan:most-common-value() tan:most-recent-dateTime() tan:must-refer-to-external-tan-file()

$n-type $n-type-label $n-type-pattern tan:no-outliers() $nonlatin-letter-numeral-pattern tan:normalize-div-text() tan:normalize-doc-space() tan:normalize-refs() ŧ normalize-space tan:normalize-text() $now tan:number-sort() tan:number-type()

tan:obeyed-by-m() tan:ordinal() tan:outliers()

ŧ pick-prepped-class-1 tan:pick-prepped-class-1-data() tan:pluck() ŧ pluck ŧ prep-class-1 ŧ prep-class-2-doc-pass-1 tan:prep-class-2-doc-pass-2() ŧ prep-class-2-doc-pass-2 tan:prep-class-2-doc-pass-3() ŧ prep-class-2-doc-pass-3 ŧ prep-class-2-doc-pass-3-old tan:prep-class-2-doc-pass-4() ŧ prep-class-2-doc-pass-4 ŧ prep-regex-char-class tan:prep-resolved-class-1-doc() tan:prep-resolved-class-2-doc() tan:prep-resolved-tan-a-div-doc() ŧ prep-rim-pass-1 ŧ prep-rim-pass-2 ŧ prep-srcs-verbosely ŧ prep-tan-a-div-pass-3-prelim ŧ prep-tan-a-div-pass-a ŧ prep-tan-a-div-pass-b tan:prep-tan-a-div-sources-for-merge() tan:prep-TAN-claims() ŧ prep-tan-claims ŧ prep-tan-key ŧ prep-tan-lm tan:prep-TAN-LM-doc-prepped() tan:prep-TAN-mor() ŧ prep-tan-mor tan:prep-verbosely() ŧ prep-verbosely ŧ prepare-class-1-doc-for-merge tan:prepend-id-or-idrefs() ŧ prepend-id-or-idrefs $primary-agent tan:process-regex-escape-k() tan:process-splits() ŧ process-splits tan:product() tan:product-loop()

ʞ q-ref') tan:q-ref() $quot

tan:raw-diff() tan:raw-diff-loop() ŧ realign-tan-a-div-sources tan:rebuild-ana-fragment() tan:recombine-docs() ŧ referenced-doc-errors tan:regex() $regex-characters-not-permitted $regex-escaping-characters $relationship-keywords-for-tan-files tan:remodel-div-ref() tan:replace() ŧ resolve-attr-include tan:resolve-doc() ŧ resolve-href tan:resolve-keyword() ŧ resolve-keyword $rng-collection $rng-collection-without-TEI tan:rom-to-int() $roman-numeral-pattern $root

$schema-collection $schema-error-ids $see-alsos-1st-da $see-alsos-resolved ŧ segment-tokd-prepped-class-1 $self-and-sources-prepped $self-and-sources-prepped-prelim $self-class-1-errors-marked $self-core-errors-marked $self-leaf-div-flatref-duplicates $self-leaf-div-flatrefs $self-prepped $self-resolved $sep-1 $sep-2 $separator-hierarchy $separator-hierarchy-minor $separator-hierarchy-minor-regex $separator-hierarchy-regex tan:sequence-collapse() tan:sequence-error() tan:sequence-expand() tan:shallow-copy() tan:shallow-equal() ŧ snap-to-word-pass-1 $soft-hyphen $source-ids $source-lacks-id $sources-1st-da $sources-prepped $sources-resolved $special-end-div-chars $special-end-div-chars-regex ŧ split-marked-fragment $src-elements $src-ids ŧ stamp-element-id tan:stamp-id() tan:string-base() tan:string-composite() tan:string-length() tan:strings-to-numeral-or-numeral-type() ŧ strip-all-attributes-except tan:strip-duplicate-nodes() tan:strip-duplicates() ŧ strip-duplicates ŧ strip-specific-attributes ŧ strip-text tan:syc-to-int() tan:synthesize-merged-group() ŧ synthesize-merged-sources $syriac-letter-numeral-pattern

$tag-urn-regex-pattern ŧ tan-a-div-merge-pass1 ŧ tan-key-errors tan:tan-type() tan:text-join() $tok-grouping-key-key $token-definitions-reserved $tokenization-nonspace tan:tokenize() tan:tokenize-div() tan:tokenize-leaf-div() ŧ tokenize-prepped-class-1

ŧ TAN-A-div-errors $TAN-elements-that-take-the-attribute-which $TAN-keyword-files $TAN-keywords $TAN-namespace

ŧ unconsolidate-anas tan:unconsolidate-tan-lm() tan:uri-directory() tan:uri-relative-to()

tan:value-of()

tan:zip-uris() $zwj

The contents of this chapter have been generated automatically. Although much effort has been spent to ensure accurate representation of the schemas and function library, you may find errors or inconsistencies. In such cases, the functions and schemas (particularly the RELAX-NG, compact syntax) are to be given priority.

Definition: ($head//@xml:id, /tei:TEI//descendant-or-self::tei:*/@xml:id)

Used by variable $duplicate-ids

Used by template ŧ core-attribute-errors

Relies upon $head .

Definition: $head//tan:IRI[not(ancestor::tan:error)]

Used by variable $duplicate-iris

Relies upon $head .

Definition: ($keys-resolved, $TAN-keywords)

No variables, keys, functions, or named templates depend upon this xsl:variable.

Relies upon $keys-resolved $TAN-keywords .

Definition: "'"

Used by variable $all-function-uses-of-error $function-error-ids $schema-error-ids

Does not rely upon global variables, keys, functions, or templates.

Definition: $self-resolved/*/(tan:body, tei:text/tei:body)

Used by variable $all-body-iris

Used by template ŧ prep-class-2-doc-pass-2

Used by function tan:merge-sources() tan:prep-class-2-doc-pass-2()

Relies upon $self-resolved .

Definition: $see-alsos-resolved[*/self::tan:TAN-c]

No variables, keys, functions, or named templates depend upon this xsl:variable.

Relies upon $see-alsos-resolved .

Definition: /*/@id

Used by variable $doc-namespace

Used by template ŧ core-errors

Used by function tan:prep-TAN-mor() tan:prep-resolved-class-2-doc() tan:resolve-doc()

Does not rely upon global variables, keys, functions, or templates.

Definition: tan:uri-directory($doc-uri)

No variables, keys, functions, or named templates depend upon this xsl:variable.

Relies upon tan:uri-directory $doc-uri .

Definition: base-uri(/*)

Used by variable $doc-parent-directory

Used by template ŧ core-errors ŧ core-attribute-errors

Does not rely upon global variables, keys, functions, or templates.

Definition: $all-iris[index-of($all-iris, .)[2]]

Used by template ŧ core-errors

Relies upon $all-iris .

Definition: tan:get-1st-doc(/*/tan:head/tan:inclusion)

Used by variable $inclusions-resolved

Used by function tan:prep-TAN-mor()

Relies upon tan:get-1st-doc .

Definition: tan:get-1st-doc($head/tan:key)

Used by variable $keys-resolved

Used by template ŧ core-errors

Used by function tan:glossary()

Relies upon tan:get-1st-doc $head .

Definition: ($head/tan:agent[tan:IRI[matches(., concat('^tag:', $doc-namespace))]])[1]

Used by template ŧ core-errors

Relies upon $head $doc-namespace .

Definition: '"'

Used by variable $all-function-uses-of-error $function-error-ids $schema-error-ids

Does not rely upon global variables, keys, functions, or templates.

Definition: '[  - ]'

Used by template ŧ core-errors

Does not rely upon global variables, keys, functions, or templates.

Definition: /

Used by template Ŧ merge-nodes ŧ core-errors

Does not rely upon global variables, keys, functions, or templates.

Definition: tan:escape($separator-hierarchy-minor)

No variables, keys, functions, or named templates depend upon this xsl:variable.

Relies upon tan:escape $separator-hierarchy-minor .

Definition: tan:escape($separator-hierarchy)

No variables, keys, functions, or named templates depend upon this xsl:variable.

Relies upon tan:escape $separator-hierarchy .

Definition: if (exists($head/tan:source/@xml:id)) then $head/tan:source/@xml:id else for $i in (1 to count($head/tan:source)) return string($i)

Used by variable $sources-resolved

Relies upon $head .

Definition: 'tag:textalign.net,2015'

Used by template ŧ tan-key-errors

Does not rely upon global variables, keys, functions, or templates.

tan:analyze-elements-with-numeral-attributes($elements as node()*, $group-by-what-attr-value as xs:string?, $analyze-only-ambiguous-types as xs:boolean, $shallow-analysis as xs:boolean) as element()*

Input: any sequence of elements that contain (either in themselves or their descendants) @n, @old, or @ref; an optional string indicating an attribute whose tokenized value should be used as a basis for grouping the results; two booleans indicating whether only ambiguous types should be checked and whether the analysis should be performed only shallowly (i.e., not on any descendants of the input elements)

Output: zero or more <ns>s (one per group, and with @type-i, @type-a, and type-i-or-a if only ambiguous types are intended), each with one or more <n>s (one per atomic value in @n or @ref of the group picked), each with one or more <val type="[i, 1, 1a, a, a1, or $, depending on the type]">[VALUE]</val>, where VALUE is what the item is when converted. If the item is @ref then any non-word strings that are used to separate refs or @n values (hyphen, comma, etc.) are retained in <sep>s.

This function is used to help other functions determine whether there is an error, or how ambiguous numerals should be interpreted

Used by template ŧ arabic-numerals ŧ arabic-numerals ŧ arabic-numerals

Used by function tan:normalize-refs() tan:resolve-doc()

Relies upon tan:aaa-to-int $n-type tan:normalize-text $n-type-pattern tan:rom-to-int $separator-hierarchy-minor $help-trigger-regex .

Option 1 (TAN-core-functions)

tan:copy-of-except($doc-fragment as item()*, $exclude-elements-named as xs:string*, $exclude-attributes-named as xs:string*, $exclude-elements-with-attributes-named as xs:string*) as item()*

short version of the full function, below

Used by template ŧ tokenize-prepped-class-1

Used by function tan:merge-tan-a-div-prepped() tan:copy-of() tan:copy-of-except()

Relies upon tan:copy-of-except .

Option 2 (TAN-core-functions)

tan:copy-of-except($doc-fragment as item()*, $exclude-elements-named as xs:string*, $exclude-attributes-named as xs:string*, $exclude-elements-with-attributes-named as xs:string*, $exclude-elements-beyond-what-depth as xs:integer?, $shallow-skip-elements-named as xs:string*) as item()*

Input: any document fragment; sequences of strings specifying names of elements to exclude, names of attributes to exclude, and names of attributes whose parent elements should be excluded; an integer beyond which depth copies should not be made

Output: the same fragment, filtered

This function was written primarily to service the merge of TAN-A-div sources, where realigned divs could be extracted from their source documents

Used by template ŧ tokenize-prepped-class-1

Used by function tan:merge-tan-a-div-prepped() tan:copy-of() tan:copy-of-except()

Relies upon ŧ copy-of-except .

tan:get-1st-doc($TAN-elements as element()*) as document-node()*

Input: any TAN elements naming files (e.g., <source>, <see-also>, <inclusion>, <key>; an indication whether some basic errors should be checked if the retrieved file is a TAN document

Output: the first document available for each element, plus/or any relevant error messages.

Used by variable $morphologies-prepped $inclusions-1st-da $keys-1st-da $sources-1st-da $see-alsos-1st-da

Used by template ŧ class-1-errors ŧ core-errors

Used by function tan:prep-TAN-mor() tan:prep-resolved-class-2-doc() tan:resolve-doc()

Relies upon tan:error tan:class-number tan:tan-type tan:first-loc-available .

tan:get-doc-hist($TAN-doc as document-node()*) as element()*

Input: any TAN document

Output: a sequence of elements with @when, @ed-when, and @when-accessed, sorted from most recent to least; each element includes @when-sort, a decimal that represents the value of the most recent time-date stamp in that element

Used by template ŧ core-errors

Relies upon tan:dateTime-to-decimal .

Option 1 (TAN-core-functions)

tan:glossary($element-that-takes-attribute-which as item()) as element()*

one-parameter version of the master one, below

Used by variable $relationship-keywords-for-tan-files

Used by template ŧ resolve-keyword

Used by function tan:has-relationship() tan:glossary()

Relies upon tan:glossary $keys-1st-da .

Option 2 (TAN-core-functions)

tan:glossary($element-that-takes-attribute-which as item(), $extra-TAN-key-docs as document-node()*, $group-name-filter as xs:string?) as element()*

Input: any element that has @which (or a string value of the name of an element that takes @which); any TAN-key documents other than the standard TAN ones; and an optional name that restricts the search to a particular group

Output: the tan:items that are valid keywords for the element in question, filtered by matches on @which, if present in the first parameter

Used by variable $relationship-keywords-for-tan-files

Used by template ŧ resolve-keyword

Used by function tan:has-relationship() tan:glossary()

Relies upon $TAN-keywords ŧ prep-tan-key .

tan:has-relationship($see-also-element as element(), $keyword as xs:string*, $extra-keys as document-node()*) as xs:boolean

Input: a <see-also> element, a sequence of strings identifying names of keywords, and any extra TAN-key files you want to check, other than the standard TAN-key files.

Output: boolean value specifying whether the <see-also> has a <relationship> that has the keyword defined

This function will first check to see if IRIs in a <relationship> match, and if no IRIs are found then the check is performed on @which (against a <name> in the key definition).

Used by template ŧ class-1-errors ŧ core-errors

Relies upon $TAN-keywords tan:glossary tan:normalize-text .

tan:interpret-n-vals($ns as xs:string*) as element()*

Input: any strings representing values of @n

Output: one element per @n, with at least one <val @type="[n-type]"> corresponding to the six types of numeral patterns/strings; if the input can be legitimately interpreted as that type, its converted value is in the element, otherwise it is empty

No variables, keys, functions, or named templates depend upon this xsl:function.

Relies upon $n-type-pattern tan:letter-to-number $n-type $separator-hierarchy-minor tan:aaa-to-int tan:rom-to-int .

Option 1 (TAN-core-functions)

tan:normalize-text($text as xs:string*) as xs:string*

one-parameter version of full function below

Used by template ŧ tan-key-errors ŧ prep-tan-lm ŧ arabic-numerals ŧ prep-class-1 ŧ prep-class-1 ŧ prep-tan-mor ŧ prep-tan-mor ŧ prep-tan-mor ŧ prep-class-2-doc-pass-1 ŧ prep-class-2-doc-pass-1 ŧ arabic-numerals ŧ prep-class-2-doc-pass-2 ŧ prep-class-2-doc-pass-3 ŧ prep-tan-key ŧ resolve-attr-include ŧ resolve-keyword ŧ class-1-errors ŧ core-errors ŧ core-attribute-errors

Used by function tan:text-join() tan:feature-test-to-groups() tan:convert-ref-to-div-fragment() tan:get-toks() tan:sequence-expand() tan:normalize-text() tan:resolve-doc() tan:has-relationship() tan:analyze-elements-with-numeral-attributes() tan:idrefs() tan:idrefs-loop()

Relies upon tan:normalize-text .

Option 2 (TAN-core-functions)

tan:normalize-text($text as xs:string*, $render-common as xs:boolean) as xs:string*

Input: any sequence of strings; a boolean indicating whether the results should be normalized further to a common form

Output: that sequence, with each item's space normalized, and removal of any help requested

A common form is one where the string is converted to lower-case, and hyphens are replaced by spaces

Used by template ŧ tan-key-errors ŧ prep-tan-lm ŧ arabic-numerals ŧ prep-class-1 ŧ prep-class-1 ŧ prep-tan-mor ŧ prep-tan-mor ŧ prep-tan-mor ŧ prep-class-2-doc-pass-1 ŧ prep-class-2-doc-pass-1 ŧ arabic-numerals ŧ prep-class-2-doc-pass-2 ŧ prep-class-2-doc-pass-3 ŧ prep-tan-key ŧ resolve-attr-include ŧ resolve-keyword ŧ class-1-errors ŧ core-errors ŧ core-attribute-errors

Used by function tan:text-join() tan:feature-test-to-groups() tan:convert-ref-to-div-fragment() tan:get-toks() tan:sequence-expand() tan:normalize-text() tan:resolve-doc() tan:has-relationship() tan:analyze-elements-with-numeral-attributes() tan:idrefs() tan:idrefs-loop()

Relies upon $help-trigger-regex .

tan:prepend-id-or-idrefs($elements-with-id-or-id-refs as element(), $string-to-prepend as xs:string?) as element()*

Input: any elements with @xml:id or an attribute that points to an element with an @xml:id value; some string that should be prepended to every value of every attribute found

Output: the same elements, but with each value prepended with the string and a double hyphen

This function is critical for disambiguating during the inclusion process.

Used by template ŧ resolve-attr-include

Relies upon ŧ prepend-id-or-idrefs .

Option 1 (TAN-core-functions)

tan:resolve-doc($TAN-documents as document-node()*) as document-node()*

one-parameter version of the fuller one, below

Used by variable $morphologies-prepped $self-resolved $inclusions-resolved $keys-resolved $sources-resolved $see-alsos-resolved

Used by template ŧ class-1-errors ŧ core-errors

Used by function tan:prep-TAN-mor() tan:prep-resolved-class-2-doc() tan:get-src-1st-da-resolved() tan:resolve-doc() tan:resolve-doc()

Relies upon tan:resolve-doc .

Option 2 (TAN-core-functions)

tan:resolve-doc($TAN-documents as document-node()*, $leave-breadcrumbs as xs:boolean, $add-attr-to-root-element-named-what as xs:string?, $add-what-val-to-new-root-attribute as xs:string*, $restrict-inclusion-to-what-element-names as xs:string*, $doc-ids-already-checked as xs:string*) as document-node()*

Input: any number of TAN documents; boolean indicating whether documents should be breadcrumbed or not; optional name of an attribute and a sequence of strings to stamp in each document's root element as a way of providing another identifier for the document; a list of element names to which any inclusion should be restricted; a list of ids for documents that should not be used to generate inclusions.

Output: those same documents, resolved, along the following steps:

1. Stamp each document with @base-uri and the optional root attribute; resolve @href, putting the original (if different) in @orig-href

2. Normalize @ref and @n, converting them whenever possible to Arabic numerals, and keeping the old versions as @orig-ref and @orig-n; if @n is a range or series, it will be expanded

3. Resolve every element that has @include.

4. Resolve every element that has @which.

5. If anything happened at #3, remove any duplicate elements.

This function and the functions connected with it are among the most important in the TAN library, since they provide critical stamping (for validation and diagnosing problems) and expand abbreviated parts (to explicitly state what is implied by @include and @which) of a TAN file. Perhaps more importantly, it is a recursive function that is used to resolve not only the beginning of the inclusion process but its middle and endpoints as well.

Used by variable $morphologies-prepped $self-resolved $inclusions-resolved $keys-resolved $sources-resolved $see-alsos-resolved

Used by template ŧ class-1-errors ŧ core-errors

Used by function tan:prep-TAN-mor() tan:prep-resolved-class-2-doc() tan:get-src-1st-da-resolved() tan:resolve-doc() tan:resolve-doc()

Relies upon tan:resolve-doc ŧ resolve-keyword tan:normalize-text ŧ resolve-attr-include ŧ arabic-numerals ŧ first-stamp tan:strip-duplicates tan:get-1st-doc tan:analyze-elements-with-numeral-attributes tan:error .

tan:resolve-keyword($items as item()*, $extra-keys as document-node()*) as item()*

Input: any items; any extra keys

Output: the same items, but with elements with @which expanded into their full form, using the predefined TAN vocabulary and the extra keys supplied

No variables, keys, functions, or named templates depend upon this xsl:function.

Relies upon ŧ resolve-keyword .

Option 1 (TAN-core-functions)

tan:sequence-error($results-of-sequence-expand as xs:integer*) as element()*

Used by template ŧ prep-tan-a-div-pass-a ŧ mark-tok-chars

Used by function tan:sequence-error()

Relies upon tan:sequence-error .

Option 2 (TAN-core-functions)

tan:sequence-error($results-of-sequence-expand as xs:integer*, $message as xs:string?) as element()*

Input: any results of the function tan:sequence-expand()

Output: error nodes, if any

Used by template ŧ prep-tan-a-div-pass-a ŧ mark-tok-chars

Used by function tan:sequence-error()

Relies upon tan:error .

tan:sequence-expand($selector as xs:string?, $max as xs:integer?) as xs:integer*

Input: a string representing a TAN selector (used by @pos, @char, @seg), and an integer defining the value of 'last'

Output: a sequence of numbers representing the positions selected, unsorted, and retaining duplicate values.

Example: ("2 - 4, last-5 - last, 36", 50) -> (2, 3, 4, 45, 46, 47, 48, 49, 50, 36)

Errors will be flagged as follows:

0 = value that falls below 1

-1 = value that surpasses the value of $max

-2 = ranges that call for negative steps, e.g., '4 - 2'

Used by template ŧ prep-tan-a-div-pass-a ŧ insert-seg-into-leaf-divs-in-hierarchy-fragment ŧ prep-tan-mor ŧ mark-tok-chars ŧ unconsolidate-anas

Used by function tan:get-picked-srcs-id-refs() tan:get-toks() tan:group-tok-elements()

Relies upon tan:normalize-text .

Option 1 (TAN-core-functions)

tan:shallow-copy($elements as element()*) as element()*

one-parameter version of the fuller one, below

Used by function tan:convert-ref-to-div-fragment() tan:shallow-copy()

Relies upon tan:shallow-copy .

Option 2 (TAN-core-functions)

tan:shallow-copy($elements as element()*, $keep-attributes as xs:boolean) as element()*

Input: any document fragment; boolean indicating whether attributes should be kept

Output: a shallow copy of the fragment, perhaps with attributes

Used by function tan:convert-ref-to-div-fragment() tan:shallow-copy()

Does not rely upon global variables, keys, functions, or templates.

Option 1 (TAN-core-functions)

tan:stamp-id($nodes as item()*, $names-of-elements-to-imprint-with-gloss-id as xs:string*) as item()*

2-parameter form of the fuller version, below

Used by function tan:stamp-id()

Relies upon tan:stamp-id .

Option 2 (TAN-core-functions)

tan:stamp-id($nodes as item()*, $names-of-elements-to-imprint-with-gloss-id as xs:string*, $name-of-attribute-to-hold-id as xs:string?) as item()*

Input: any element or document fragment, one or more strings of the names of elements that should be imprinted with @id

Output: the same, with any elements whose names match the input with @id added, consisting of the name of the element appended with the number of its position relative to all preceding elements of the same name.

Used by function tan:stamp-id()

Relies upon ŧ stamp-element-id .