TAN-class-2 global variables, keys, and functions summarized

Definition: if ($head/tan:source/@xml:id) then false(() else true(()

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

Relies upon $head .

Definition: $head/tan:source

Used by variable $src-ids

Used by function tan:get-src-1st-da() tan:get-picked-srcs-id-refs()

Relies upon $head .

Looks for elements matching tan:div

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

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

tan:analyze-ref($ref as xs:string) as element()

Input: any @ref's value

Output: series of <ref>s, punctuated by <comma> or <dash>; each <ref> holds the likely best value; if that differs from the original, @orig holds the original value of the ref

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

Relies upon ŧ analyze-ref .

tan:convert-ref-to-div-fragment($prepped-src-doc as document-node(), $element-with-ref-attr as element(), $keep-text as xs:boolean, $missing-ref-returned-as-info-not-error as xs:boolean) as item()*

Input: source document, at least prepped; an element with an unresolved @ref; indication whether the text should be retrieved or not

Output: a fragment from the source document with the hierarchies of only those divs that correspond to the range specified by @ref

It is assumed that the second parameter refers to the first; that is, the source document really is the one that the element with @ref is trying to cite.

It is also assumed that in any range where the second element has fewer @n values than the first, then the abbreviated form will be checked before the form actually stated. For example, 1 1 - 2 will be tested first for 1 1 - 1 2, which, if not corresponding to an actual <div>, will be interpeted as 1 1 - 2

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

Relies upon tan:analyze-ref $help-trigger-regex tan:normalize-text tan:pluck tan:shallow-copy tan:help tan:error tan:info .

tan:cull-prepped-class-1-data($elements-with-atomic-src-and-ref-attributes as element()*, $src-1st-da-prepped as document-node()*, $treat-src-and-ref-as-regex as xs:boolean) as document-node()*

Used to create a subset of $src-1st-da-prepped

Input: (1) prepped source documents. (2) one or more elements with @src and @ref. It is assumed that both

attributes have single, atomic values (i.e., no ranges in @ref). (3) boolean indicating whether the values

of @src and @ref should be treated as regular expressions

Output: src-1st-da-prepped, proper subset, excluding matches

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

Relies upon tan:error ŧ cull-prepped-class-1 .

tan:element-key($node as node()) as xs:string?

Used by template Ŧ merge-nodes

Used by function tan:recombine-docs()

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

tan:expand-tok($tok-elements as element()*, $src-1st-da-tokenized as document-node()*) as element()*

Input: any <tok> with atomic @src and @ref values; any number of tokenized source documents

Output: one <tok> per token invoked, adding @n to specify where in the <div> the token is to be found; if @chars is present it is replaced with a space-delimited list of integers

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

Relies upon tan:get-toks ŧ mark-tok-chars .

Option 1 (TAN-class-2-functions)

tan:get-src-1st-da-tokenized($class-2-doc-prepped-step-3 as document-node()?, $resolved-class-1-doc as document-node()*) as document-node()*

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

Relies upon tan:get-src-1st-da-tokenized .

Option 2 (TAN-class-2-functions)

tan:get-src-1st-da-tokenized($class-2-doc-prepped-step-3 as document-node()?, $resolved-class-1-doc as document-node()*, $add-n-attr as xs:boolean, $tokenize-selectively as xs:boolean) as document-node()*

Input: class-2 document prepped through stage 3; related source class 1 documents, resolved; boolean indicating whether @n should be added to new <tok>s; boolean indicating whether the entirety of the documents should be tokenized, or only those leaf difvs that are mentioned by the class 2 document

Output: same class 1 documents tokenized, selectively or completely

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

Relies upon ŧ tokenize-prepped-class-1 .

tan:get-toks($tokenized-div as element()?, $tok-elements as element()*) as element()*

returns the <tok>s from a given <div>, including @n with integer position

Input: (1) any <div> with <tok> and <non-tok> children (result of tan:tokenize-prepped-1st-da(()) (2) any number of <tok>s that are deemed to relate to the <div> chosen (i.e., @src and @ref will be ignored, assumed to correspond to the input <div>)

Output: the <tok> elements picked.

Used by function tan:expand-tok()

Relies upon tan:normalize-text tan:sequence-expand tan:help-requested tan:error tan:help .

Option 1 (TAN-class-2-functions)

tan:group-by-IRIs($elements-with-IRI-children as element()*) as element()*

Used by variable $features-grouped

Used by function tan:prep-class-2-doc-pass-2() tan:group-by-IRIs()

Relies upon tan:group-by-IRIs .

Option 2 (TAN-class-2-functions)

tan:group-by-IRIs($elements-with-IRI-children as element()*, $equate-elements as element()*) as element()*

Input: Any elements that have children <IRI>s; a sequence of elements that pre-determine select equations

Output: Those same elements grouped as children of either <equate-works>, <equate-div-types>, or <group> (depending upon name of element), based on equivalencies in IRI values. Each <group> will also include an @n value, acting as a kind of identifier.

Note, IRI equivalencies are greedy and transitive. If element X has IRI A, Y has IRIs A and B, and Z has IRI B, then elements X and Z will be equated.

Used by variable $features-grouped

Used by function tan:prep-class-2-doc-pass-2() tan:group-by-IRIs()

Relies upon tan:error tan:group-by-IRIs-loop .

tan:group-by-IRIs-loop($tree-of-groups-so-far as element()?, $elements-to-group as element()*) as element()*

Input: an element containing zero or more <group> children; a sequence of elements yet to be placed

in a <group>

Output: a sequence of groups (= <equate-works>, <equate-div-types>, or <group>) lumping together elements

based on commonality of their <IRI> values

Used by function tan:group-by-IRIs() tan:group-by-IRIs-loop()

Relies upon tan:group-by-IRIs-loop .

tan:max-integer($input as xs:string) as xs:integer?

input: string of TAN @pos or @chars selectors

output: largest integer, ignoring value of 'last'

E.g., "5 - 15, last-20" -> 15

Useful for validation routines that want merely to check if a range is out of limits

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

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

tan:min-last($input as xs:string, $last as xs:integer) as xs:integer

input: @pos or @chars selectors, number defining "last"

output: smallest reference related to "last"

E.g., "5 - 15, last-20", 34 -> 14

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

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

tan:normalize-refs($elements-with-attr-ref as element()*, $ambiguous-numeral-types as element()*) as xs:string*

Input: elements that take @ref; a numeral types declaration (elements produced by tan:analyze-attr-n-or-ref-numerals(())

Output: a sequence of punctuation- and space-normalized reference strings, converting the items that match numerals into Arabic numerals and setting the strings lowercase

Used by template ŧ unconsolidate-anas

Relies upon tan:analyze-elements-with-numeral-attributes $n-type $separator-hierarchy .

tan:pick-prepped-class-1-data($elements-with-atomic-src-and-ref-attributes as element()*, $src-1st-da-prepped as document-node()*, $treat-src-and-ref-as-regex as xs:boolean) as document-node()*

Used to create a subset of $src-1st-da-prepped

Input: (1) prepped source documents. (2) one or more elements with @src and @ref. It is assumed that both

attributes have single, atomic values (i.e., no ranges in @ref). (3) boolean indicating whether the values

of @src and @ref should be treated as regular expressions

Output: src-1st-da-prepped, proper subset that consists exclusively of matches

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

Relies upon tan:error ŧ pick-prepped-class-1 .

Option 1 (TAN-class-2-functions)

tan:prep-resolved-class-2-doc($resolved-class-2-doc as document-node()?) as document-node()*

Used by variable $self-and-sources-prepped-prelim $self-and-sources-prepped $self-and-sources-prepped

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

Relies upon $doc-id $sources-resolved tan:resolve-doc tan:get-1st-doc tan:prep-resolved-class-2-doc .

Option 2 (TAN-class-2-functions)

tan:prep-resolved-class-2-doc($resolved-class-2-doc as document-node()?, $resolved-class-2-sources as document-node()*) as document-node()*

Input: a class 2 document

Output: that same document, prepped, followed by its source documents, which have been prepped enough to justify or explain the content of the original class 2 document

Preparation of a class 2 document is complicated, requiring navigation back and forth between the class-2 document and its sources, resolving them along the way. The first document returned is always the resolved class-2 document. Any documents that follow are resolved sources. Here's the process that is followed:

FOCUS ALTERATIONS

======= =============================================================================================

sources Resolve each source document (including add @src to root element)

self Expand @src (<equate-works> gets special treatment), @div-type-ref; normalize @ref; add @xml:id to TAN-LM <source>; add @group to elements that take @cont; add @work to continuations that should take it

self Expand <token-definition> and (TAN-A-div) <equate-works>, <equate-div-types>

sources Add @work to each root element (TAN-A-div), rename @ns, suppress select div types, replace div types with numerical equivalent. Sources' flat ref should now be commensurate with class 2 file's use of @ref.

self Expand @work, @ref (iterate elements over calculated values); provide help on <equate-works> and <equate-div-types>

sources Tokenize and (if the self is a TAN-A-div) segment those <div>s that are referred to

self Expand @val, @pos for <tok>, look for errors in previous step

self Check for errors in previous steps

[Further preparation is then conducted by the functions specific to the particular class 2 format]

Used by variable $self-and-sources-prepped-prelim $self-and-sources-prepped $self-and-sources-prepped

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

Relies upon tan:prep-class-2-doc-pass-2 tan:prep-resolved-class-1-doc tan:prep-class-2-doc-pass-3 tan:get-src-1st-da-tokenized tan:prep-class-2-doc-pass-4 ŧ prep-class-2-doc-pass-1 ŧ class-2-errors .

tan:tokenize-div($divs as element()*, $token-definitions as element()) as element()*

Input: any <div>s, a <token-definition>

Output: the <divs>s in tokenized form

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

Relies upon ŧ tokenize-prepped-class-1 .