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
.
Definition: if ($src-elements/@xml:id) then $src-elements/@xml:id else '1'
Used by function tan:get-src-1st-da
() tan:get-picked-srcs-id-refs
() tan:get-src-1st-da-resolved
()
Relies upon $src-elements
.
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:help
tan:info
tan:analyze-ref
tan:error
$help-trigger-regex
tan:shallow-copy
tan:pluck
tan:normalize-text
.
tan:counts-to-firsts($seq as xs:integer*) as xs:integer*
Input: sequence of numbers representing counts of items.
Output: sequence of numbers representing the first position of each item within the total count.
E.g., (4, 12, 0, 7) - > (1, 5, 17, 17)
No variables, keys, functions, or named templates depend upon this xsl:function.
Does not rely upon global variables, keys, functions, or templates.
tan:counts-to-lasts($seq as xs:integer*) as xs:integer*
Input: sequence of numbers representing counts of items.
Output: sequence of numbers representing the last position of each item within the total count.
E.g., (4, 12, 0, 7) - > (4, 16, 16, 23)
No variables, keys, functions, or named templates depend upon this xsl:function.
Does not rely upon global variables, keys, functions, or templates.
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-src-and-div-type-ref($elements-with-src-and-div-type as element()*) as element()*
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon ŧ prep-class-2-doc-pass-1
.
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
.
tan:get-context-prepped($class-2-self3 as document-node(), $class-2-context-self2 as document-node()*, $srcs-prepped as document-node()*, $srcs-resolved as document-node()*) as document-node()*
Input: a class 2 document, transformed to level $self2
or higher; one or more contextual class 2 documents whose should reference system should be reconciled to the first document; the intervening source documents, in both prepped and resolved forms.
Output: the class 2 context documents, with values converted (where needed) to the main class 2 document
This function is used primarily in the context of a TAN-A-div file, where one finds supplementary TAN-LM and TAN-A-tok data that provide contextual information about source documents. This function will convert those satellite class 2 files to the naming conventions adopted in the original class 2 files. Because the prepped sources are oftentimes the intermediary, they are like a spoke connecting the original document (the hub) to the contextual documents (the rim).
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon tan:error
tan:prep-resolved-class-1-doc
tan:prep-class-2-doc-pass-3
ŧ prep-rim-pass-1
ŧ prep-rim-pass-2
.
tan:get-picked-srcs-id-refs($srcs-picked as item()*) as xs:string*
Used by function tan:get-src-1st-da
()
Relies upon tan:sequence-expand
$src-elements
$src-ids
.
Option 1 (TAN-class-2-functions)
tan:get-src-1st-da() as document-node()*
zero-parameter version of the function below
Used by function tan:get-src-1st-da
() tan:get-src-1st-da-resolved
()
Relies upon tan:get-src-1st-da
$src-ids
.
Option 2 (TAN-class-2-functions)
tan:get-src-1st-da($srcs-picked as item()*) as document-node()*
This version allows one to exclude certain sources from processing
Used by function tan:get-src-1st-da
() tan:get-src-1st-da-resolved
()
Relies upon tan:get-picked-srcs-id-refs
tan:first-loc-available
$src-elements
$empty-doc
.
Option 1 (TAN-class-2-functions)
tan:get-src-1st-da-resolved()
zero-parameter version of the next function
Used by function tan:get-src-1st-da-resolved
()
Relies upon tan:get-src-1st-da-resolved
tan:get-src-1st-da
$src-ids
.
Option 2 (TAN-class-2-functions)
tan:get-src-1st-da-resolved($picked-class-1-docs as document-node()*, $picked-src-ids as xs:string*)
Used by function tan:get-src-1st-da-resolved
()
Relies upon tan:resolve-doc
.
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-src-1st-da-with-lms($tokenized-class-1-doc as document-node(), $prepped-tan-lm-docs as document-node()*) as document-node()
Input: any tokenized class 1 document; any prepped TAN-LM documents
Output: the original document, imprinted with lexico-morphological data
For now, this function assumes that every TAN-LM document pertains to the tokenized class-1 doc
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon ŧ add-lm-to-tok
.
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:error
tan:help
tan:normalize-text
tan:matches
tan:help-requested
tan:sequence-expand
.
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.
Option 1 (TAN-class-2-functions)
tan:normalize-refs($elements-with-attr-ref as element()*) as xs:string*
Used by template ŧ unconsolidate-anas
Used by function tan:normalize-refs
()
Relies upon tan:normalize-refs
.
Option 2 (TAN-class-2-functions)
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
Used by function tan:normalize-refs
()
Relies upon tan:analyze-elements-with-numeral-attributes
$n-type
$separator-hierarchy
.
tan:ordinal($in as xs:integer*) as xs:string*
Input: one or more numerals
Output: one or more strings with the English form of the ordinal form of the input number
E.g., (1, 4, 17) -> ('first','fourth','17th').
No variables, keys, functions, or named templates depend upon this xsl:function.
Does not rely upon global variables, keys, functions, or templates.
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
.
tan:prep-class-2-doc-pass-2($class-2-doc-prepped-pass-1 as document-node()?, $src-1st-da-resolved as document-node()*) as document-node()*
Input: class 2 document that has already gone through pass 1 of preparation; resolved documents
Output: the class 2 document, with expansions of <equate-works>
and <equate-div-types>
and determination of <token-definition>
.
Used by function tan:prep-resolved-class-2-doc
()
Relies upon tan:error
$token-definitions-reserved
tan:group-by-IRIs
ŧ prep-class-2-doc-pass-2
.
tan:prep-class-2-doc-pass-3($class-2-doc-prepped-pass-2 as document-node()?, $sources-prepped-1 as document-node()*) as document-node()?
Input: a class-2 document, that has gone through two stages of preparation; sources that have gone through one level of preparation
Output: the class-2 document with @work
and @ref
expanded; provide help on <equate-works>
, <equate-div-types>
(TAN-A-div)
Used by function tan:prep-resolved-class-2-doc
() tan:get-context-prepped
()
Relies upon ŧ prep-class-2-doc-pass-3
.
tan:prep-class-2-doc-pass-4($class-2-doc-prepped-pass-3 as document-node()?, $sources-selectively-tokenized as document-node()*) as document-node()?
Used by function tan:prep-resolved-class-2-doc
()
Relies upon ŧ prep-class-2-doc-pass-4
.
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:get-src-1st-da-tokenized
tan:prep-resolved-class-1-doc
ŧ class-2-errors
ŧ prep-class-2-doc-pass-1
tan:prep-class-2-doc-pass-4
tan:prep-class-2-doc-pass-3
.
tan:product($numbers as item()*) as xs:double?
Input: a sequence of numbers
Output: the product of those numbers
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon tan:product-loop
.
tan:product-loop($product-so-far as xs:double?, $numbers-to-multiply as item()*) as xs:double?
Used by function tan:product
() tan:product-loop
()
Relies upon tan:product-loop
.
tan:recombine-docs($docs-to-recombine as document-node()*, $ref-sort-key-docs as document-node()*) as document-node()*
Input: any number of documents
Output: recombined documents
This function is useful for cases where you have both picked and culled
from a source, and you wish to combine the two documents into a single one
that strips away duplicates. NB, the results may not preserve the original
document order of an original document. It also treats non-leaf white-
space text nodes as dispensible.
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon tan:element-key
Ŧ merge-nodes
.
tan:shallow-equal($element-1 as element()?, $element-2 as element()?) as xs:boolean
Input: any two elements. Output: true if shallowly equal.
Two elements are shallowly equal if (1) they both have the same name; (2) the name of every
attribute in one is the name of an attribute in the other; and (3) for every pair of attributes,
every space-separated value in one is found in the other. Any descendants are ignored.
Example:
Input:
<div class="gum mug droop">Testing</div>
<div class="droop mug gum droop">Different text</div>
Output: true
No variables, keys, functions, or named templates depend upon this xsl:function.
Does not rely upon global variables, keys, functions, or templates.
tan:strip-duplicate-nodes($nodes-to-check as node()*, $checked-nodes as node()*) as node()*
Used by template Ŧ merge-nodes
Used by function tan:strip-duplicate-nodes
()
Relies upon tan:strip-duplicate-nodes
.
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
.
tan:unconsolidate-tan-lm($tan-lm-docs as document-node()*, $srcs-tokenized as document-node()*) as document-node()*
Reformats TAN-LM files, such that each <ana>
has one and only
one <tok>
+ <l>
+ <m>
combination
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon ŧ unconsolidate-anas
.
Used by template Ŧ merge-nodes
Used by function tan:recombine-docs
()
Relies upon tan:strip-duplicate-nodes
tan:element-key
Ŧ merge-nodes
.