Functions, global variables, keys, and named templates

Functions, global variables, keys, and named templates are summarized below, grouped by parent subdirectory from the TAN function directory. For templates called by mode, see the next section.

Option 1 (TAN-fn-expand-files)

tan:expand-doc($tan-doc as document-node()?) as document-node()*

one-parameter version of the fuller one below 

Used by variable $tan:morphologies-expanded, $tan:self-expanded.

Used by template ŧ tan:core-expansion-verbose, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:expand-doc().

Relies upon tan:expand-doc.

Option 2 (TAN-fn-expand-files)

tan:expand-doc($tan-doc as document-node()?, $target-phase as xs:string) as document-node()*

two-parameter version of the fuller one below 

Used by variable $tan:morphologies-expanded, $tan:self-expanded.

Used by template ŧ tan:core-expansion-verbose, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:expand-doc().

Relies upon tan:expand-doc.

Option 3 (TAN-fn-expand-files)

tan:expand-doc($tan-doc as document-node()?, $target-phase as xs:string, $use-validation-mode as xs:boolean)

Input: a resolved TAN document, a string indicating a phase of expansion, a boolean 
indicating whether the function is intended to serve validation 
Output: the document and its dependencies expanded to the phase indicated. 
If validation mode is true, then the results will be stripped down to root element and 
the bare markers for errors, warnings, and fixes. If validation mode is false, then the 
complete, expanded document and its dependencies will be returned. 
Because class 2 files are expanded hand-in-glove with the class 1 files they depend 
upon, expansion is necessarily synchronized with its dependent sources. The expanded 
form of the original class-2 document is the first document of the result, and the 
expanded class-1 or -3 files follow. A TAN-A file expanded verbosely will return as its last 
document one TAN-A_merge file per work detected. TAN-A_merge files collate into a single 
master reference system all <source>s of the TAN-A file that are versions of that work. 

Related: expansion, files

Used by variable $tan:morphologies-expanded, $tan:self-expanded.

Used by template ŧ tan:core-expansion-verbose, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:expand-doc().

Relies upon $tan:doc-id, $tan:morphologies-resolved, $tan:sources-resolved, $tan:validation-phase-names, tan:expand-doc(), tan:normalize-tree-space, tan:xml-to-string, ŧ tan:catalog-expansion-terse, ŧ tan:class-1-expansion-verbose-pass-1, ŧ tan:class-1-expansion-verbose-pass-2, ŧ tan:class-1-expansion-verbose-pass-3, ŧ tan:class-2-expansion-normal, ŧ tan:class-2-expansion-terse, ŧ tan:class-2-expansion-terse-for-validation, ŧ tan:class-2-expansion-verbose, ŧ tan:core-expansion-normal, ŧ tan:core-expansion-terse, ŧ tan:core-expansion-terse-attributes, ŧ tan:core-expansion-verbose, ŧ tan:dependency-adjustments-pass-1, ŧ tan:dependency-adjustments-pass-2, ŧ tan:mark-dependencies-pass-1, ŧ tan:mark-dependencies-pass-2, ŧ tan:mark-dependencies-pass-2-for-validation, ŧ tan:remove-first-token, ŧ tan:reset-hierarchy, ŧ tan:resolve-reference-tree-numerals, ŧ tan:strip-dependencies-to-markers, ŧ tan:strip-distributed-vocabulary-from-idrefs, ŧ tan:strip-for-validation, ŧ tan:tan-a-lm-expansion-terse.

Option 1 (TAN-fn-regex-standard)

rgx:analyze-string($input as xs:string?, $pattern as xs:string) as element()

two-parameter version of the fuller one, below 

Used by function rgx:analyze-string().

Relies upon rgx:analyze-string.

Option 2 (TAN-fn-regex-standard)

rgx:analyze-string($input as xs:string?, $pattern as xs:string, $flags as xs:string) as element()

Input: three strings 
Output: an XML structure that identifies which parts of the first parameter matched 
or failed to match the regular expression, supplied by the send parameter, taking into 
account flags supplied by the third. In the case of matched substrings, indicates 
substrings matched each capturing group in the regular expression. 

Related: regular expressions, strings

Used by function rgx:analyze-string().

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

Option 1 (TAN-fn-regex-standard)

rgx:codepoints-to-string($arg as xs:integer*) as xs:string?

one-parameter version of the fuller one below; default XML 1.0 

Used by function rgx:codepoints-to-string(), rgx:process-regex-escape-u().

Relies upon rgx:codepoints-to-string.

Option 2 (TAN-fn-regex-standard)

rgx:codepoints-to-string($arg as xs:integer*, $xml-1-0 as xs:boolean) as xs:string?

Input: any number of integers 
Output: the string value representation, but only if the integers represent valid 
characters in XML 
Like fn:codepoints-to-string(), but filters out XML illegal characters 

Related: regular expressions, codepoints, strings

Used by function rgx:codepoints-to-string(), rgx:process-regex-escape-u().

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

Option 1 (TAN-fn-regex-standard)

rgx:matches($input as xs:string?, $pattern as xs:string) as xs:boolean

two-param function of the three-param version below 

Used by function rgx:matches(), rgx:regex-is-valid().

Relies upon rgx:matches.

Option 2 (TAN-fn-regex-standard)

rgx:matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean

Parallel to fn:matches(), but converts \u{} into classes. See rgx:regex() for 
details. 
Input: three strings 
Output: true if the first string matches the regular expression supplied as the 
second, taking account into flags supplied by the third. 

Related: regular expressions, strings

Used by function rgx:matches(), rgx:regex-is-valid().

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

Option 1 (TAN-fn-regex-standard)

rgx:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string

three-param function of the four-param version below 

Used by function rgx:replace().

Relies upon rgx:replace.

Option 2 (TAN-fn-regex-standard)

rgx:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string

Parallel to fn:replace(), but converts \u{} into classes. See rgx:regex() for 
details. 
Input: four strings 
Output: the xs:string that is obtained by replacing each non-overlapping 
substring of the first parameter given pattern declared by the second with an occurrence of the 
third, taking into account flags supplied by the fourth. 

Related: regular expressions, strings

Used by function rgx:replace().

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

Option 1 (TAN-fn-regex-standard)

rgx:replace-by-char-name($string-to-replace as xs:string?, $words-in-name-to-drop as xs:string*, $words-in-replacement-char-name as xs:string*, $words-not-in-replacement-char-name as xs:string*, $search-is-strict as xs:boolean?) as xs:string?

five-parameter version of the full function, below 

Used by function rgx:replace-by-char-name().

Relies upon rgx:replace-by-char-name.

Option 2 (TAN-fn-regex-standard)

rgx:replace-by-char-name($string-to-replace as xs:string?, $words-in-name-to-drop as xs:string*, $words-in-replacement-char-name as xs:string*, $words-not-in-replacement-char-name as xs:string*, $search-is-strict as xs:boolean?, $version as xs:double) as xs:string?

six-parameter version of the full function, below 

Used by function rgx:replace-by-char-name().

Relies upon rgx:replace-by-char-name.

Option 1 (TAN-fn-regex-standard)

rgx:string-base($arg as xs:string?) as xs:string?

one-param version of the fuller one, below 

Used by function rgx:string-base(), rgx:process-regex-escape-u().

Relies upon rgx:string-base.

Option 2 (TAN-fn-regex-standard)

rgx:string-base($arg as xs:string?, $version as xs:double) as xs:string?

Input: a string and a double 
Output: the string, with each character reduced to its base character 
This function takes any string and replaces every character with its base Unicode 
character. This function is useful to prepare a text to be searched without respect to accents. 
E.g., ἄνθρωπός - > ανθρωπος Note, the ς is retained because it doesn't decompose. To match 
on σ one needs to use the flag 'i' (case insensitive) because ς case-folds to σ. This 
function is similar to rgx:string-to-components(), but strictly enforces a one-for-one 
replacement, so that it behaves much like fn:lower-case() and fn:upper-case(), where the string 
length is always preserved. To this end, this function is based on fn:translate(), and uses 
simple decomposition databases, which are much smaller and quicker to use than are full 
decomposition databases. The strict one-for-one replacement observes the following rules: If a 
character decomposes to a single character, that single character is returned. If a character 
decomposes to multiple characters that are identical, that single character is returned, 
e.g., ‴ to ′ If a character decomposes to multiple characters, a distinction is made 
between base and non-base characters: 
- Base characters: 
\p{Lu}\p{Ll}\p{Lt}\p{Lo}\p{N}\p{S} 
- Non-base characters: \p{Lm}\p{M}\p{P}\p{Z}\p{C} If after non-base 
characters are removed there is not exactly one unique decomposed character left, the original 
input is retained. The above rules are already reflected in the contents of the simple 
decomposition database, so do not need to be expressed in this function. For more, see 
ucd/ucd-decomp.xsl. 

Related: regular expressions, strings

Used by function rgx:string-base(), rgx:process-regex-escape-u().

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

Option 1 (TAN-fn-regex-standard)

rgx:string-to-components($arg as xs:string?) as xs:string*

one-param version of the fuller one, below 

Used by function rgx:string-to-components().

Relies upon rgx:string-to-components.

Option 2 (TAN-fn-regex-standard)

rgx:string-to-components($arg as xs:string?, $version as xs:double) as xs:string*

Input: any string; a Unicode version number. 
Output: one string per character in the input; if a character lends itself to 
decomposition, its component parts are returned, otherwise the character itself is returned. 
This function is the inverse of rgx:string-to-composites(). 
If you wish to have more control over which components are returned (e.g., exclusion 
of combining marks), consider using either rgx:string-base() or the database 
directly: rgx:get-ucd-decomp-db(). The each rgx:char/rgx:b has @gc with the code for the 
component's general category 

Related: regular expressions, strings

Used by function rgx:string-to-components().

Relies upon $default-ucd-decomp-db.

Option 1 (TAN-fn-regex-standard)

rgx:string-to-composites($arg as xs:string?) as xs:string*

one-parameter version of fuller one, below 

Used by function rgx:string-to-composites(), rgx:process-regex-escape-u().

Relies upon rgx:string-to-composites.

Option 2 (TAN-fn-regex-standard)

rgx:string-to-composites($arg as xs:string?, $version as xs:double) as xs:string*

Input: a string; a version of Unicode (double) 
Output: one string per character in the input; that string consists of the character 
itself followed by all characters that use it as a base 
This function is the inverse of rgx:string-to-components. E.g., 'Max' - > 
'MᴹḾṀṂℳⅯⓂ㎆㎒㎫㎹㎿㏁M𝐌𝑀𝑴𝓜𝔐𝕄𝕸𝖬𝗠𝘔𝙈𝙼🄼🅋🅪🅫aªàáâãäåāăąǎǟǡǻȁȃȧᵃḁẚạảấầẩẫậắằẳẵặₐ℀℁ⓐ㏂a𝐚𝑎𝒂𝒶𝓪𝔞𝕒𝖆𝖺𝗮𝘢𝙖𝚊xˣẋẍₓⅹⅺⅻⓧx𝐱𝑥𝒙𝓍𝔁𝔵𝕩𝖝𝗑𝘅𝘹𝙭𝚡' 
This is useful for preparing regex character classes to broaden a search. 

Related: regular expressions, strings

Used by function rgx:string-to-composites(), rgx:process-regex-escape-u().

Relies upon $default-ucd-decomp-db.

Option 1 (TAN-fn-regex-standard)

rgx:tokenize($input as xs:string?, $pattern as xs:string) as xs:string*

two-param function of the three-param version below 

Used by function rgx:tokenize().

Relies upon rgx:tokenize.

Option 2 (TAN-fn-regex-standard)

rgx:tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string*

Parallel to fn:tokenize(), but converts \u{} into classes. See rgx:regex() for 
details. 
Input: three strings 
Output: the first string cut into a sequence of strings, with any substring that 
matches the second parameter treated as a separator, not returned, taking account into 
flags supplied by the third. 

Related: regular expressions, strings

Used by function rgx:tokenize().

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

TAN-variables-standard

Definition: $tan:head/(* except (tan:inclusion | tan:vocabulary | tan:tan-vocabulary))//tan:IRI[not(ancestor::tan:error)]

Used by variable $tan:duplicate-head-iris.

Relies upon $tan:head.

TAN-variables-standard

Definition: '*'

Used by template ŧ tan:dependency-adjustments-pass-2, ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1.

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

TAN-variables-extended

Definition: tan:resolve-doc$tan:annotations-1st-da, false(), tan:attr'relationship', 'annotation'))

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

Relies upon $tan:annotations-1st-da, tan:attr, tan:resolve-doc.

TAN-variables-standard

Definition: ($tan:base26-key, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/')

Used by function tan:dec-to-n(), tan:n-to-dec().

Relies upon $tan:base26-key.

TAN-variables-standard

Definition: if ($tan:doc-namespace = $tan:TAN-namespace) then $tan:self-resolved/*/(tan:body, tei:text/tei:body) else //*:body

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

Relies upon $tan:TAN-namespace, $tan:doc-namespace, $tan:self-resolved.

TAN-variables-standard

Definition: [\|‖

⁣]

Used by template ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1.

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

TAN-variables-standard

Definition: ­

Used by variable $tan:shy, $tan:special-end-div-chars.

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

TAN-variables-standard

Definition: tan:catalog-uris/)

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

Relies upon tan:catalog-uris.

TAN-variables-standard

Definition: tan:catalogs/, $tan:default-validation-phase eq 'verbose')

Used by variable $tan:local-catalog.

Relies upon tan:catalogs.

TAN-variables-standard

Definition: tan:class-number($tan:self-resolved)

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

Relies upon $tan:self-resolved.

TAN-variables-extended

Definition: tan:cfne/)

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

Relies upon tan:cfne.

TAN-variables-extended

Definition: tan:get-doc-history/)

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

Relies upon tan:get-doc-history.

TAN-variables-standard

Definition: /*/@id

Used by variable $tan:doc-is-error-test.

Used by template ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:check-referred-doc, ŧ tan:core-expansion-terse, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:expand-doc().

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

TAN-variables-standard

Definition: namespace-uri(/*)

Used by variable $tan:body.

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

TAN-variables-standard

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

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

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

TAN-variables-standard

Definition: for $i in $tan:TAN-vocabularies-vocabulary/tan:TAN-voc/tan:body/tan:item[tan:location] return tan:get-1st-doc$i)

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

Relies upon $tan:TAN-vocabularies-vocabulary, tan:get-1st-doc.

TAN-variables-standard

Definition: $tan:doc-catalogs[1]

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

Relies upon $tan:doc-catalogs.

TAN-variables-extended

Definition: $tan:local-TAN-collection[name(*) = 'TAN-voc']

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

Relies upon $tan:local-TAN-collection.

TAN-variables-extended

Definition: tan:expand-doc$tan:morphologies-resolved, 'terse', false())

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

Relies upon $tan:morphologies-resolved, tan:expand-doc.

TAN-variables-standard

Definition: $tan:id-idrefs/tan:id-idrefs/tan:id[tan:idrefs[@attribute = 'object']]/tan:element

Used by template ŧ tan:core-expansion-terse.

Relies upon $tan:id-idrefs.

TAN-variables-standard

Definition: $tan:id-idrefs/tan:id-idrefs/tan:id[tan:idrefs[@attribute = 'subject']]/tan:element

Used by template ŧ tan:core-expansion-terse.

Relies upon $tan:id-idrefs.

TAN-variables-standard

Definition: $tan:id-idrefs/tan:id-idrefs/tan:id/tan:idrefs/@element

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

Relies upon $tan:id-idrefs.

TAN-variables-standard

Definition: /

Used by template ŧ tan:core-expansion-normal.

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

TAN-variables-extended

Definition: tan:resolve-doc$tan:predecessors-1st-da, false(), tan:attr'relationship', 'predecessor'))

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

Relies upon $tan:predecessors-1st-da, tan:attr, tan:resolve-doc.

TAN-variables-standard

Definition: ('1 dev', '2018', '2020')

Used by template ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1.

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

TAN-variables-standard

Definition: $tan:head/tan:file-resp

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

Relies upon $tan:head.

TAN-variables-extended

Definition: tan:resolve-doc$tan:see-alsos-1st-da, false(), tan:attr'relationship', 'see-also'))

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

Relies upon $tan:see-alsos-1st-da, tan:attr, tan:resolve-doc.

TAN-variables-extended

Definition: tan:vocabulary(), (), ($tan:self-expanded/(*/tan:head | (tan:TAN-A | tan:TAN-voc)/tan:body)))

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

Relies upon $tan:self-expanded, tan:vocabulary.

TAN-variables-extended

Definition: tan:normalize-tree-space$tan:self-resolved, true())

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

Relies upon $tan:self-resolved, tan:normalize-tree-space.

TAN-variables-standard

Definition: $tan:dhy

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

Relies upon $tan:dhy.

TAN-variables-standard

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

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

Relies upon $tan:head.

TAN-variables-extended

Definition: tan:resolve-doc$tan:successors-1st-da, false(), tan:attr'relationship', 'successor'))

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

Relies upon $tan:successors-1st-da, tan:attr, tan:resolve-doc.

TAN-variables-extended

Definition: $tan:TAN-vocabularies[tan:TAN-voc/@id = 'tag:textalign.net,2015:tan-voc:features']

Used by template ŧ tan:build-morpheus-ana tan:build-morpheus-lex.

Relies upon $tan:TAN-vocabularies.

TAN-variables-standard

Definition: false()

Used by template ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:core-expansion-terse.

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

TAN-variables-standard

Definition: 'http://www.tei-c.org/ns/1.0'

Used by template ŧ tan:check-referred-doc.

Used by function tan:resolve-doc-loop().

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

TAN-variables-standard

Definition: $tan:token-definitions-reserved[../tan:name = 'letters and punctuation']

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

Relies upon $tan:token-definitions-reserved.

TAN-variables-standard

Definition: $tan:token-definitions-reserved[../tan:name = 'letters only']

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

Relies upon $tan:token-definitions-reserved.

TAN-variables-standard

Definition: $tan:token-definitions-reserved[../tan:name = 'nonspace']

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

Relies upon $tan:token-definitions-reserved.

TAN-variables-extended

Definition: \S+\.\w+

Used by function tan:parse-urls().

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

TAN-variables-standard

Definition:

Used by variable $tan:special-end-div-chars.

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

TAN-variables-standard

Definition:

Used by variable $tan:special-end-div-chars.

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

TAN-keys-extended

Looks for elements matching tan:ana

Used by function tan:lm-data().

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

TAN-keys-standard

Looks for elements matching *

Used by template ŧ tan:mark-dependencies-pass-2, ŧ tan:class-2-expansion-terse tan:class-2-expansion-terse-for-validation.

Used by function tan:get-via-q-ref().

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

TAN-fn-arrays-extended

tan:xml-to-array($items-to-array as item()*) as array(*)*

Input: XML tree fragments 
Output: those parts that conform to the output of tan:array-to-xml() converted to 
arrays. Anything in the input tree not matching array:array or array:member will be 
skipped, unless it is a member an array:array or array:member. Anything in the array:member 
will be bound as the type assigned by the value of @type 

Related: arrays, tree manipulation, nodes

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

Relies upon ŧ tan:xml-to-map-and-array.

Option 1 (TAN-fn-hash-and-check)

tan:checksum-fletcher-64($str as xs:string?) as xs:string?

one-parameter version of the fuller one, below 

Used by template ŧ tan:diff-to-delta.

Used by function tan:get-diff-output-transpositions(), tan:apply-deltas().

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

Option 2 (TAN-fn-hash-and-check)

tan:checksum-fletcher-64($str as xs:string?, $output-hex as xs:boolean) as item()?

Input: a string, a boolean 
Output: if the second parameter is true, a hexadecimal representation of the 
Fletcher 64 checksum on the string, otherwise its integer representation 

Related: checksums

Used by template ŧ tan:diff-to-delta.

Used by function tan:get-diff-output-transpositions(), tan:apply-deltas().

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

Option 1 (TAN-fn-file-archive-extended)

tan:archive-available($element-with-attr-href-or-string-with-resolved-uri as item()?) as xs:boolean

Input: any element with an @href, or a string value (or something castable to a 
string) 
Output: a boolean indicating whether the document is available 
The input url must be resolved. 

Related: files, archives

Used by function tan:xlsx-file-available(), tan:docx-file-available().

Relies upon $advanced-functions-available.

Option 2 (TAN-fn-file-archive-extended)

tan:archive-available($element-with-attr-href-or-string-with-resolved-uri as item()?) as xs:boolean

Input: any element with an @href, or a string value (or something castable to a 
string) 
Output: a boolean indicating whether the document is available 
Note, this version of the function, i.e., the one without advanced functions, 
cannot fetch a uri collection from an archive, so the algorithm has to be told what 
particular component to find. Because it was written for docx and xlsx files, this function 
looks only for the signature _rels/.rels. 
The input url must be resolved. 
We use the protocol jar: because it is recognized both by oXygen and by Saxon run on the 
command line 

Related: files, archives

Used by function tan:xlsx-file-available(), tan:docx-file-available().

Relies upon $advanced-functions-available.

Option 1 (TAN-fn-file-archive-extended)

tan:open-archive($element-with-attr-href-or-string-with-resolved-uri as item()?) as document-node()*

Input: any element with an @href, or a string value (or something castable to a 
string); a string specifying the type of file to be opened 
Output: the components of the target docx or xslx file as a sequence of XML documents 
(the main .rels file first, then the document .rels, then the source content types, then 
every file ending in .xml). To facilitate the reconstruction of the Word file, every 
extracted document will be stamped with @_archive-path, with the local path and name of the 
component. 

Related: files, archives

Used by function tan:open-docx(), tan:open-xlsx().

Relies upon $advanced-functions-available, tan:open-raw-archive.

Option 2 (TAN-fn-file-archive-extended)

tan:open-archive($element-with-attr-href-or-string-with-resolved-uri as item()?) as document-node()*

Input: any element with an @href, or a string value (or something castable to a 
string); a string specifying the type of file to be opened 
Output: the components of the target docx or xslx file as a sequence of XML documents 
(the main .rels file first, then the document .rels, then the source content types, then 
every file ending in .xml). To facilitate the reconstruction of the Word file, every 
extracted document will be stamped with @_archive-path, with the local path and name of the 
component. 

Related: files, archives

Used by function tan:open-docx(), tan:open-xlsx().

Relies upon $advanced-functions-available.

Option 1 (TAN-fn-files-extended)

tan:open-file($resolved-urls)

1-parameter version of the main one below 

Used by function tan:open-file().

Relies upon tan:open-file.

Option 2 (TAN-fn-files-extended)

tan:open-file($resolved-urls, $target-fallback-encoding as xs:string*) as document-node()*

Input: items that can be resolved as strings; a string 
Output: for each resolvable string in the first parameter, if a document is 
available, the document; if it is not, but unparsed text is available, a document with the 
unparsed text wrapped in a root element; otherwise an empty document node. If unparsed text is 
not available, another attempt will be made on a fallback encoding specified by the 2nd 
parameter. 
If the file is plain text that is not XML, it will be wrapped by a root element of an XML 
document. That root node will have @xml:base pointing to the source url. 
If it is a .docx file, the components XML documents of the Word document will be 
returned. 

Related: files

Used by function tan:open-file().

Relies upon tan:open-docx.

Option 1 (TAN-fn-file-archive-extended)

Input: a sequence of documents that each have @_archive-path stamped in the root 
element (the result of tan:open-docx()); a resolved uri for the new Word document 
Output: an archive saved at the URL specified by the second parameter 

Used by template Ŧ tan:save-docx, Ŧ tan:save-xlsx.

Used by function tan:save-archive().

Relies upon $advanced-functions-available, ŧ tan:clean-up-archive.

Option 2 (TAN-fn-file-archive-extended)

Input: a sequence of documents that each have @_archive-path stamped in the root 
element (the result of tan:open-docx()); a resolved uri for the new Word document 
Output: an archive saved at the URL specified by the second parameter 
Ordinarily, this template would be a function, but security reasons dictate that 
<xsl:result-document> always fails in the context of a function. 
In this function, the target subdirectory for the archive must already exist, or 
else you might get an error. 

Used by template Ŧ tan:save-docx, Ŧ tan:save-xlsx.

Used by function tan:save-archive().

Relies upon $advanced-functions-available, ŧ tan:clean-up-archive.

TAN-fn-html-core

Definition: 'accesskey', 'aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-dropeffect', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-live', 'aria-orientation', 'aria-owns', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'autocapitalize', 'autofocus', 'class', 'contenteditable', 'dir', 'draggable', 'enterkeyhint', 'hidden', 'id', 'inputmode', 'is', 'itemid', 'itemprop', 'itemref', 'itemscope', 'itemtype', 'lang', 'nonce', 'onabort', 'onauxclick', 'onblur', 'oncancel', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'onclose', 'oncontextmenu', 'oncopy', 'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onfocus', 'onformdata', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onpaste', 'onpause', 'onplay', 'onplaying', 'onprogress', 'onratechange', 'onreset', 'onresize', 'onscroll', 'onsecuritypolicyviolation', 'onseeked', 'onseeking', 'onselect', 'onslotchange', 'onstalled', 'onsubmit', 'onsuspend', 'ontimeupdate', 'ontoggle', 'onvolumechange', 'onwaiting', 'onwheel', 'slot', 'spellcheck', 'style', 'tabindex', 'title', 'translate'

Used by template ŧ tan:tree-to-html.

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

Option 1 (TAN-fn-html-core)

tan:convert-to-html($fragment-to-convert as item()*, $parse-text-for-urls as xs:boolean) as item()*

2-param version of fuller one, below 

Used by function tan:convert-to-html(), tan:diff-or-collate-to-html().

Relies upon tan:convert-to-html.

Option 2 (TAN-fn-html-core)

tan:convert-to-html($fragment-to-convert as item()*, $parse-a-hrefs as xs:boolean, $attributes-to-retain-regex as xs:string, $keep-attributes-named-after-global-html-attributes as xs:boolean) as item()*

Input: Any XML tree fragment; a boolean; a string 
Output: The fragment converted to HTML (described below); if the boolean is true, 
text will be parsed for URLs and wrapped in <a href="">; if the third parameter is a valid 
regular expression, attributes whose names match the pattern will be retained unchanged. 
Every element is converted to an HTML <div>, with the name of the element or attribute 
being placed inside the @class as a value: e-[NAME] for elements and a-[NAME] for 
attributes. In addition, if the element or attribute is in a namespace, the namespace is included 
as a class value, ns-[NAMESPACE PREFIX]. Comments and processing instructions are 
preserved intact. 
Any element already in the HTML namespace will be left as-is, with templates 
continued to be applied to its descendants. 
Some attributes are handled specially: Every @xml:* is retained, but with only the 
local name, no prefix. Every attribute in an html element is retained as-is. No attribute 
@class is rendered as an element. No attribute beginning with _ is rendered as an element, 
and it is retained as-is. (It is your responsibility to get rid of temporary attributes 
you do not want, either before or after this function runs.) 

Related: html, nodes, tree manipulation

Used by function tan:convert-to-html(), tan:diff-or-collate-to-html().

Relies upon tan:get-namespace-map, ŧ tan:parse-a-hrefs, ŧ tan:tree-to-html.

TAN-fn-html-diff-and-collate

tan:diff-or-collate-to-html($diff-or-collate-results as element()?, $primary-version-ref as xs:string?, $primary-version-tree as element()*) as item()*

Input: the results of tan:diff() or tan:collate(), ideally when given wrapped by 
<group> along with statistics; perhaps a string; perhaps a tree structure (see below) 
Output: the results converted to HTML divs, with the following provisos: 
* Any 
adjustments to the text of the diff/collate output should be run beforehand, optimally via 
tan:replace-diff() or tan:replace-collation(). 
* The second parameter points to an idref. If the main 
input is a diff, then the expected value is 'a' or 'b' (default). If it is a collation, then it 
is a label that points to tan:collation/tan:witness/@id (default: the last one, if no 
match). The resolved parameter points to the primary version. 
* The third parameter is a 
tree structure of elements with the primary version. This is structure that will become 
the primary way to view the diff/collation. The diff/collation will be chopped 
proportionally to be infused into the text nodes of the tree. This allows the HTML file to be 
structured not as a flat diff/collate, but in a hierarchy that is native to one of the versions. 
* 
Collation ids are case-sensitive; diffs, however, must be simply a or b. 
* Any notices or other 
elements must be inserted before processing. 

Related: html, diff, tree manipulation

Used by function tan:diff-or-collate-to-html().

Relies upon tan:convert-to-html, tan:diff, tan:diff-or-collate-to-html(), tan:ellipses, tan:shallow-copy, tan:trim-long-tree, ŧ diff-or-collate-to-html-output-pass-1.

TAN-fn-language-extended

tan:convert-morphological-codes($TAN-A-lm-to-convert as document-node()?, $morphology-ids-to-convert as xs:string, $morphology-code-conversion-maps as map(*)*) as document-node()?

Input: a TAN-A-lm file, a sequence of strings, maps that are the result of 
tan:morphological-code-conversion-maps() 
Output: the TAN-A-lm file, with relevant <m> codes converted. This will be applied 
only to <m> whose closest @morphology is one of the strings from the second parameter, and 
codes will be converted from the source to the target according to the maps supplied. 
The second parameter can be empty; If so, then the default with be the values in 
/tan:TAN-A-lm/tan:body/@morphology 
This function does not change the vocabulary or @morphology codes. That must be done 
separately. 
See comments at tan:morphological-code-conversion-maps() regarding 
difficulties inherent in mapping grammatical systems to each other. 

Related: language, lexicomorphology

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

Relies upon ŧ tan:convert-morphological-codes.

TAN-fn-language-extended

tan:morphological-code-conversion-maps($source-TAN-mor-resolved as document-node(), $target-TAN-mor-resolved as document-node()) as map(*)*

Input: two TAN-mor files, resolved 
Output: a sequence of one or more maps, one per category in the first TAN-mor file. If 
the first TAN-mor file lacks categories, then only one map is returned. Each map's map 
entries have keys corresponding to the morphological codes allowed for that category. The 
values consists of an array. Each array member is a sequence of two items: an integer and a 
string. The integer specifies the position of the target morphological category and the 
string, the morphological code. The order of the array members corresponds to apparent 
preference. 
Non-categorized morphologies can take advantage of <alias> to build complex 
grammatical features, which complicates the output of this function somewhat. Mapping from 
simple feature to simple feature is straightforward. Mapping from complex feature to 
simple feature requires a one-to-many map, and if a complex feature in the source 
morphology does not have a counterpart in the target for every simple feature that makes up the 
complex one, then no match exists and the code is not supported. It gets a bit tougher for 
mapping to a complex feature in the target morphology. Preleminary work is done to find those 
complex features, then detect every mapping of simple or complex objects that could be 
translated into that target complex feature. If the source morphology is category-based, the 
result is a regular expression to match against <m>. If the source morphology lacks 
categories, then an alphabetized list of codes becomes the key to the target complex feature. A 
map of to all target complex features is inserted in the first output map. These can be 
found simply by looking for the presence of space or the opening ^ in the key name. 
Because TAN-mor was designed to enable a wide range of grammatical constructions, 
and because designers have different views on language and categories, converting 
from one morphological code system to another can be messy, with features in either the 
source or target that lack any counterpart in the other. Or there may be overlapping results 
when assessing complex features. For example, in the Perseus system for Greek, a word 
marked as a singular personal pronoun will have at least three grammatical categories that 
will result in a mapping to the Brown system for English as both NN (singular noun) and NP 
(proper noun), both of which are true. It is up to users to discern on a case-by-case basis the 
best way to resolve ambiguity and incommensurability. 

Related: language, lexicomorphology

Used by function tan:morphological-code-conversion-maps().

Relies upon tan:array-permutations, tan:duplicate-items, tan:morphological-code-conversion-maps(), tan:vocabulary, ŧ tan:add-category-position.

Option 1 (TAN-fn-maps-extended)

tan:map-put($map as map(*), $put-map as map(*), $at-depth as xs:integer, $target-map-must-have-what-key as xs:anyAtomicType?) as map(*)

4-parameter version of the complete function below. 
Here the 2nd parameter is simply a map, all of whose map entries are intended 
insertions. This allows the user of the function to make multiple insertions at once. 

Used by function tan:map-put().

Relies upon tan:map-put.

Option 2 (TAN-fn-maps-extended)

tan:map-put($map as map(*), $key as xs:anyAtomicType, $value as item()*, $at-depth as xs:integer, $target-map-must-have-what-key as xs:anyAtomicType?) as map(*)

Input: a map; an atomic type representing a key for a new map entry; any items, 
representing the value for a new map entry; an integer, specifying the depth of map to receive the 
entry (0 or less will apply to every map); a string, specifying a key that must be present in a 
map that must receive the entry. 
Output: the input map, but with a new map entry at each map of depth specified by the 
fourth parameter, provided that it has a key specified by the fifth. 
If the fourth parameter is less than 0, then the entry will be placed throughout every 
map: the initial map itself and any enclosed map of any depth. 
If the fifth parameter is not empty, then the target map must have a map entry with an 
identical key for it to qualify to take the new map entry; if the parameter is empty, this 
qualification is ignored. 
If a key exists already in a target map, the new entry replaces the current one, 
otherwise it is added as a new map entry. 
This function parallels map:put(), but allows for deep placement of entries. This 
function was written to support a more DRY-friendly approach to creating maps for 
transform(), which has submaps that might need to be altered and refactored, depending on various 
conditions. 
It is presently difficult to select particular deep maps for a target action. The 
last two parameters of this function provide a bit of control over where the action is 
applied. One strategy that can be adopted, to use this function better, is to supply in each map 
a single map entry with a key corresponding to an id (perhaps via fn:generate-id()) 
with an empty value. That empty map entry then can serve as a hook equivalent to @xml:id in 
an element. 

Related: maps

Used by function tan:map-put().

Relies upon tan:item-type, ŧ tan:map-put.

Option 1 (TAN-fn-maps-extended)

tan:map-to-xml($items-to-convert as item()*) as element()*

one-parameter version of fuller one below 

Used by function tan:map-to-xml(), tan:get-diff-output-transpositions(), tan:replace-diff().

Relies upon tan:map-to-xml.

Option 2 (TAN-fn-maps-extended)

tan:map-to-xml($items-to-convert as map(*)*, $sort-keys as xs:boolean) as element()*

Input: any maps; a boolean 
Output: any maps in each item serialized as XML elements; the map entries will be 
sorted lexicographically by the key's string value if the boolean is true, otherwise the 
order of map entries is implementation-dependent. 
For those accustomed to handling ordinary XML nodes, maps can be frustrating to work 
with. This function allows one to change a map to XML, and do fun things with it, without 
requiring map functions. 

Related: maps, nodes

Used by function tan:map-to-xml(), tan:get-diff-output-transpositions(), tan:replace-diff().

Relies upon ŧ tan:map-and-array-to-xml.

TAN-fn-maps-extended

tan:xml-to-map($items-to-map as item()*) as map(*)*

Input: XML tree fragments 
Output: those parts that conform to the output of tan:map-to-xml() converted to 
maps. Anything in the input tree not matching <map:map>, <map:entry>, <map:key>, 
<map:value> will be skipped, unless it is a member of <map:key> or <map:value>. Anything in the 
key or value will be bound as the type assigned by the values of @type.. 

Related: maps, nodes, tree manipulation

Used by template ŧ tan:build-maps-and-arrays.

Relies upon ŧ tan:xml-to-map-and-array.

TAN-fn-merging

tan:group-divs($divs-to-group as element()*) as element()*

Input: expanded <div>s 
Output: those <div>s grouped in <group>s according to their <ref> values 
Attempt is made to preserve original div order 

Related: merging, grouping, tree manipulation

Used by template ŧ tan:merge-divs.

Used by function tan:group-divs().

Relies upon tan:collate-sequences, tan:group-divs(), tan:group-elements-by-shared-node-values.

Option 1 (TAN-fn-merging)

tan:merge-divs($expanded-class-1-fragment as item()*) as item()*

one-parameter version of the fuller one below 

Used by function tan:merge-divs().

Relies upon tan:merge-divs.

Option 2 (TAN-fn-merging)

tan:merge-divs($expanded-class-1-fragment as item()*, $itemize-leaf-divs as xs:boolean) as item()*

two-parameter version of the fuller one below 

Used by function tan:merge-divs().

Relies upon tan:merge-divs.

Option 3 (TAN-fn-merging)

tan:merge-divs($expanded-class-1-fragment as item()*, $itemize-leaf-divs as xs:boolean, $exclude-elements-with-duplicate-values-of-what-attribute as xs:string?, $keep-last-duplicate as xs:boolean?) as item()*

Input: expanded class 1 document fragment whose individual <div>s are assumed to be 
in the proper hierarchy (result of tan:normalize-text-hierarchy()); a boolean 
indicating whether leaf divs should be itemized; an optional string representing the name of an 
attribute to be checked for duplicates 
Output: the fragment with the <div>s grouped according to their <ref> values 
If the 2nd parameter is true, for each leaf <div> in a group there will be a separate 
<div type="#version">; otherwise leaf divs will be merely copied 
For merging multiple files normally the value should be true; if they are misfits 
from a single source, false 

Related: merging, tree manipulation, grouping

Used by function tan:merge-divs().

Relies upon ŧ tan:merge-divs.

TAN-fn-merging

tan:merge-expanded-docs($expanded-docs as document-node()*) as document-node()?

Input: Any TAN documents that have been expanded at least tersely 
Output: A document that is a collation of the documents. There is one <head> per 
source, but only one <body>, with contents merged. 
Templates will be placed in the appropriate function file, e.g., class 1 merge 
templates are in TAN-class-1-functions.xsl 
Class 1 merging: All <div>s with the same <ref> values are grouped together. If the 
class 1 files are sources of a class 2 file, it is assumed that all actions in the 
<adjustments> have already been performed. 
Class 2 merging: TBD 
Class 3 merging: TBD 
NB: Class 1 files must have their hierarchies in proper order; use reset-hierarchy 
beforehand if you're unsure 

Related: merging, files

Used by template ŧ tan:class-1-expansion-verbose-pass-1.

Relies upon ŧ tan:merge-tan-docs.

Option 1 (TAN-fn-nodes-standard)

tan:copy-indentation($items-to-indent as item()*, $model-element as element()) as item()*

2-parameter version of fuller one below 

Used by function tan:copy-indentation().

Relies upon tan:copy-indentation.

Option 2 (TAN-fn-nodes-standard)

tan:copy-indentation($items-to-indent as item()*, $model-element as element(), $tail-indentation-type as xs:string?) as item()*

Input: items that should be indented; an element whose indentation should be 
imitated; a string: 'full', 'short', or 'none' 
Output: the items, indented according to the pattern 
If the third parameter is 'full', the last indentation after the series will be like 
the first; if it is 'short', it will be one indentation less than full (appropriate for 
the last child of a wrapping element); if it is 'none' no final indentation will be 
supplied. This parameter affects only the topmost sequence, not the children, which are 
formatted as demanded. 

Related: nodes, tree manipulation, spacing

Used by function tan:copy-indentation().

Relies upon ŧ tan:indent-items.

Option 1 (TAN-fn-nodes-standard)

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 ŧ tan:mark-reassigns, ŧ tan:apply-inclusions-and-adjust-vocabulary, ŧ tan:core-expansion-normal, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:copy-of-except().

Relies upon tan:copy-of-except.

Option 2 (TAN-fn-nodes-standard)

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, altered 
This function was written primarily to service the merge of TAN-A sources, where 
realigned divs could be extracted from their source documents 

Related: nodes, tree manipulation

Used by template ŧ tan:mark-reassigns, ŧ tan:apply-inclusions-and-adjust-vocabulary, ŧ tan:core-expansion-normal, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:copy-of-except().

Relies upon ŧ tan:copy-of-except.

TAN-fn-nodes-extended

tan:get-ref($class-1-element as element()?) as xs:string*

Input: any element 
Output: every possible combination of @n values from the self-and-ancestor nodes, 
string-joined by the hierarchy separator. 
This function is useful for handling raw or resolved class 1 files, and you need to get 
references 

Related: nodes, pointers, identifiers

Used by key ʞ tan:div-via-calculated-ref.

Relies upon $tan:separator-hierarchy.

Option 1 (TAN-fn-nodes-standard)

tan:group-elements-by-shared-node-values($elements-to-group as element()*) as element()*

One-parameter version of the fuller one below. 

Used by template ŧ tan:core-expansion-terse.

Used by function tan:group-elements-by-shared-node-values(), tan:group-elements-by-IRI(), tan:group-divs-by-ref(), tan:group-divs().

Relies upon tan:group-elements-by-shared-node-values.

Option 2 (TAN-fn-nodes-standard)

tan:group-elements-by-shared-node-values($elements-to-group as element()*, $regex-of-names-of-nodes-to-group-by as xs:string?) as element()*

Two-parameter version of the fuller one below 

Used by template ŧ tan:core-expansion-terse.

Used by function tan:group-elements-by-shared-node-values(), tan:group-elements-by-IRI(), tan:group-divs-by-ref(), tan:group-divs().

Relies upon tan:group-elements-by-shared-node-values.

Option 3 (TAN-fn-nodes-standard)

tan:group-elements-by-shared-node-values($elements-to-group as element()*, $regex-of-names-of-nodes-to-group-by as xs:string?, $group-by-shallow-node-value as xs:boolean) as element()*

Input: a sequence of elements; an optional string representing the name of children 
in the elements 
Output: the same elements, but grouped in <group> according to whether the text 
contents of the child elements specified are equal 
Each <group> will have an @n stipulating the position of the first element put in the 
group. That way the results can be sorted in order of their original elements 
Transitivity is assumed. Suppose elements X, Y, and Z have children values A and B; B 
and C; and C and D, respectively. All three elements will be grouped, even though Y and Z do 
not directly share children values. 

Related: nodes, grouping

Used by template ŧ tan:core-expansion-terse.

Used by function tan:group-elements-by-shared-node-values(), tan:group-elements-by-IRI(), tan:group-divs-by-ref(), tan:group-divs().

Relies upon tan:duplicate-items, tan:group-elements-by-shared-node-values(), ŧ tan:build-grouping-key.

TAN-fn-nodes-standard

tan:normalize-tree-space($input-tree as item()*, $remove-special-end-div-chars as xs:boolean) as item()*

Input: any XML tree; boolean 
Output: the same, but space-normalized: 
- all outer indentations are removed 
- if 
an element is known to contain only non-mixed content, all inner text nodes are 
space-normalized 
- otherwise any element that contains non-space text will be space-normalized: 
- 
initial space is removed 
- in the text from the first through last non-space character 
(excluding special end-div characters) any sequence of consecutive space characters will be 
replaced by a single word space; that single word space will be placed in the first text node 
only, and any other text nodes that contain the consecutive space character block will 
have all initial space removed 
- any final space characters in the string value of the 
element will be removed 
- if the last non-space character is not a special end-div 
character, a single word space will be added at the end 
- if the 2nd parameter is true, any special 
end-div characters will be removed 
Because this function attends to space normalization as a mixed-content problem, 
it will space-normalize select TEI constructions. 
Expanded TAN files are space normalized via this function, so there is no sense in 
running them again. In fact, it can introduce errors (because special div-end characters 
have already been removed). 

Related: nodes, spacing, tree manipulation

Used by variable $tan:self-resolved-plus.

Used by template ŧ tan:get-and-resolve-dependency.

Used by function tan:expand-doc().

Relies upon ŧ tan:normalize-tree-space, ŧ tan:selectively-adjust-tei-space, ŧ tan:strip-outer-indentation.

Option 1 (TAN-fn-nodes-extended)

tan:remove-duplicate-siblings($items-to-process as item()*) as item()*

one-parameter version of larger one, below 

Used by function tan:remove-duplicate-siblings().

Relies upon tan:remove-duplicate-siblings.

Option 2 (TAN-fn-nodes-extended)

tan:remove-duplicate-siblings($items-to-process as document-node()*, $element-names-to-check as xs:string*) as item()*

Input: any items 
Output: the same documents after removing duplicate elements whose names match the 
second parameter. 
This function is applied during document resolution, to prune duplicate elements 
that might have been included 

Related: nodes, tree manipulation

Used by function tan:remove-duplicate-siblings().

Relies upon ŧ tan:remove-duplicate-siblings.

TAN-fn-nodes-extended

tan:restore-chopped-tree($tree-slices as item()*) as item()*

Input: a sequence of items 
Output: sequence that attempts to restore the items in a single tree 
This function reverses the effects of tan:chop-tree(), but does so on the basis of 
the chopped fragments, not a map. By default, adjacent items of the same node type are 
fused into a single node of the same type, except for elements, which must have the same 
name, namespace, and attributes for them to be fused. 

Related: nodes, tree manipulation

Used by function tan:restore-chopped-tree().

Relies upon tan:element-fingerprint, tan:item-type, tan:restore-chopped-tree, tan:shallow-copy.

Option 1 (TAN-fn-nodes-standard)

tan:sequence-to-tree($sequence-to-reconstruct as item()*) as item()*

One-parameter version of the more complete one below 

Used by template ŧ tan:normalize-tree-space.

Used by function tan:sequence-to-tree(), tan:chop-tree().

Relies upon tan:sequence-to-tree.

Option 2 (TAN-fn-nodes-standard)

tan:sequence-to-tree($sequence-to-reconstruct as item()*, $fix-orphan-text as xs:boolean) as item()*

Input: a result of tan:tree-to-sequence(); a boolean 
Output: the original tree; if the boolean is true, then any first children that 
precede the next level will be wrapped in an element like the first child element. 
If a given opening tag has a corresponding <_close-at> then what is between will 
become the children of the element, and what comes after its following siblings. 
This is the inverse of the function tan:tree-to-sequence(). That is, 
tan:sequence-to-tree$i) => tan:tree-to-sequence() should result in a copy of $i.. 
This function is especially helpful for a raw text transcription that needs to be 
converted to a class-1 body via the inline numerical references. The technique is to replace 
the numerical references with empty <div>s, each one with @n and @type correctly 
assessed based on the match, and a @_level to specify where in the hierarchy it should sit. 
You may wish to run the results of this output through 
tan:consolidate-identical-adjacent-divs() 

Related: nodes, tree manipulation

Used by template ŧ tan:normalize-tree-space.

Used by function tan:sequence-to-tree(), tan:chop-tree().

Relies upon ŧ tan:sequence-to-tree.

Option 1 (TAN-fn-nodes-standard)

tan:shallow-copy($items as item()*) as item()*

one-parameter version of the fuller one, below 

Used by template ŧ tan:get-and-resolve-dependency, ŧ tan:mark-dependencies-pass-1, ŧ tan:dependency-adjustments-pass-2, ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:dependency-adjustments-pass-1, ŧ tan:resolve-critical-dependencies-loop, ŧ tan:check-referred-doc, ŧ tan:mark-dependencies-for-validation, ŧ tan:core-expansion-terse, ŧ tan:class-1-expansion-verbose-pass-2, ŧ tan:first-stamp-shallow-skip, ŧ tan:mark-reassigns, ŧ tan:trim-long-tree, ŧ tan:resolve-href tan:expand-standard-tan-voc, ŧ diff-or-collate-to-html-output-pass-1.

Used by function tan:shallow-copy(), tan:restore-chopped-tree(), tan:attribute-vocabulary(), tan:get-1st-doc(), tan:error(), tan:diff-or-collate-to-html().

Relies upon tan:shallow-copy.

Option 2 (TAN-fn-nodes-standard)

tan:shallow-copy($items as item()*, $depth as xs:integer) as item()*

Input: any document fragment; boolean indicating whether attributes should be 
kept 
Output: a shallow copy of the fragment 
Attributes will be preserved in a shallow-copied element. 
Maps and arrays will be discarded. 
This function was written to truncate large trees for output to messages and 
diagnostic result trees. 

Related: nodes, tree manipulation

Used by template ŧ tan:get-and-resolve-dependency, ŧ tan:mark-dependencies-pass-1, ŧ tan:dependency-adjustments-pass-2, ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:dependency-adjustments-pass-1, ŧ tan:resolve-critical-dependencies-loop, ŧ tan:check-referred-doc, ŧ tan:mark-dependencies-for-validation, ŧ tan:core-expansion-terse, ŧ tan:class-1-expansion-verbose-pass-2, ŧ tan:first-stamp-shallow-skip, ŧ tan:mark-reassigns, ŧ tan:trim-long-tree, ŧ tan:resolve-href tan:expand-standard-tan-voc, ŧ diff-or-collate-to-html-output-pass-1.

Used by function tan:shallow-copy(), tan:restore-chopped-tree(), tan:attribute-vocabulary(), tan:get-1st-doc(), tan:error(), tan:diff-or-collate-to-html().

Relies upon ŧ tan:fn-shallow-copy.

Option 1 (TAN-fn-nodes-extended)

tan:sort-change-log($TAN-fragment as item()*) as item()*

one-parameter version of the fuller one, below 

Used by function tan:sort-change-log().

Relies upon tan:sort-change-log.

Option 2 (TAN-fn-nodes-extended)

tan:sort-change-log($TAN-fragment as item()*, $sort-by-time-then-agent as xs:boolean?, $sort-ascending as xs:boolean?) as item()*

Input: a TAN fragment; two booleans 
Output: the TAN fragment but with the change log sorted, either by time or agent (1st 
boolean) and either ascending or descending (2nd boolean) 

Related: nodes, versioning

Used by function tan:sort-change-log().

Relies upon ŧ tan:sort-change-log.

Option 1 (TAN-fn-nodes-standard)

tan:stamp-q-id($items-to-stamp as item()*) as item()*

1-param version of the full one below 

Used by template ŧ tan:core-expansion-terse-attributes-to-elements.

Used by function tan:stamp-q-id().

Relies upon tan:stamp-q-id.

Option 2 (TAN-fn-nodes-standard)

tan:stamp-q-id($items-to-stamp as item()*, $stamp-shallowly as xs:boolean) as item()*

Input: any XML fragments 
Output: the fragments with @q added to each element via generate-id() 

Related: nodes, identifiers

Used by template ŧ tan:core-expansion-terse-attributes-to-elements.

Used by function tan:stamp-q-id().

Relies upon ŧ tan:stamp-q-id.

Option 1 (TAN-fn-nodes-TAN-output)

tan:update-TAN-change-log($TAN-file as document-node()?) as document-node()?

one-parameter version of fuller one, below 

Used by function tan:update-TAN-change-log().

Relies upon $tan:doc-uri, tan:update-TAN-change-log.

Option 2 (TAN-fn-nodes-TAN-output)

tan:update-TAN-change-log($TAN-file as document-node()?, $agent-IRIs as xs:string+, $agent-names as xs:string+, $agent-base-uri-resolved as xs:string?, $agent-type as xs:string, $agent-responsibility as xs:string, $change-message as xs:string, $source-base-uri as xs:string) as document-node()?

Input: a TAN file; assorted parameters pertaining to the agent that created or 
changed the file 
Output: The TAN file with appropriate credit/blame given 
It is presumed that the TAN file is in its raw state, and that indentation should be 
respected. 
If an agent type is not recognized, the default will be algorithm. 

Related: nodes, versioning

Used by function tan:update-TAN-change-log().

Relies upon $tan:TAN-vocabularies, tan:has-vocab, tan:normalize-name, tan:resolve-doc, tan:update-TAN-change-log(), tan:uri-relative-to, tan:vocabulary, ŧ tan:update-TAN-change-log.

Option 1 (TAN-fn-nodes-standard)

tan:xml-to-string($fragment as item()*) as xs:string?

one-parameter version of the fuller one, below 

Used by template ŧ tan:mark-dependencies-pass-1, ŧ tan:class-1-expansion-verbose-pass-3, ŧ tan:mark-dependencies-for-validation, ŧ tan:core-expansion-normal.

Used by function tan:xml-to-string(), tan:expand-doc(), tan:get-1st-doc().

Relies upon tan:xml-to-string.

Option 2 (TAN-fn-nodes-standard)

tan:xml-to-string($fragment as item()*, $ignore-whitespace-text-nodes as xs:boolean) as xs:string?

Input: any fragment of XML; boolean indicating whether whitespace nodes should be 
ignored 
Output: a string representation of the fragment 
This function is a proxy of serialize(), used to represent XML fragments in plain 
text, useful in validation reports or in generating guidelines 

Related: nodes, serialization, strings

Used by template ŧ tan:mark-dependencies-pass-1, ŧ tan:class-1-expansion-verbose-pass-3, ŧ tan:mark-dependencies-for-validation, ŧ tan:core-expansion-normal.

Used by function tan:xml-to-string(), tan:expand-doc(), tan:get-1st-doc().

Relies upon ŧ tan:fragment-to-text.

TAN-fn-numerals-extended

tan:int-to-aaa($integers as xs:integer*) as xs:string*

Input: any integers 
Output: the alphabetic representation of those numerals 

Related: numerals, numerics

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-fn-numerals-standard)

tan:string-to-numerals($string-to-analyze as xs:string?) as xs:string*

one-parameter version of the function below 

Used by template ŧ tan:check-and-expand-ranges, ŧ tan:resolve-numerals, ŧ tan:class-1-expansion-verbose-pass-2.

Used by function tan:string-to-numerals(), tan:analyze-sequence(), tan:string-to-int().

Relies upon tan:string-to-numerals.

Option 2 (TAN-fn-numerals-standard)

tan:string-to-numerals($string-to-analyze as xs:string?, $ambig-is-roman as xs:boolean?, $return-only-numerals as xs:boolean?, $n-alias-items as element()*, $numeral-exceptions as xs:string*) as xs:string*

Input: a string thought to contain numerals of some type (e.g., Roman); a boolean 
indicating whether ambiguous letters should be treated as Roman numerals or letter numerals; a 
boolean indicating whether only numeral matches should be returned 
Output: the string with parts that look like numerals converted to Arabic numerals 
Does not take into account requests for help 

Related: numerals, strings

Used by template ŧ tan:check-and-expand-ranges, ŧ tan:resolve-numerals, ŧ tan:class-1-expansion-verbose-pass-2.

Used by function tan:string-to-numerals(), tan:analyze-sequence(), tan:string-to-int().

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

TAN-fn-numeric-conversion

tan:base64Binary-to-hex($in as xs:base64Binary?) as xs:string?

Input: a base64Binary 
Output: a string with the value in hexadecimal 

Related: numerics

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

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

TAN-fn-numerics-extended

tan:product($numbers as xs:anyAtomicType*) as xs:anyAtomicType?

Input: a sequence of numbers 
Output: the product of those numbers 

Related: numerics

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-fn-resolve-files)

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

One-parameter version of fuller one below 

Used by variable $tan:annotations-resolved, $tan:see-alsos-resolved, $tan:predecessors-resolved, $tan:successors-resolved, $tan:self-resolved, $tan:redivisions-resolved, $tan:model-resolved, $tan:sources-resolved, $tan:morphologies-resolved.

Used by template ŧ tan:get-and-resolve-dependency, ŧ tan:check-referred-doc, ŧ tan:core-expansion-terse, ŧ tan:class-1-expansion-verbose-pass-1, ŧ tan:core-expansion-verbose.

Used by function tan:resolve-doc(), tan:update-TAN-change-log(), tan:resolve-doc-loop().

Relies upon tan:resolve-doc.

Option 2 (TAN-fn-resolve-files)

tan:resolve-doc($TAN-document as document-node()?, $add-q-ids as xs:boolean, $attributes-to-add-to-root-element as attribute()*) as document-node()?

Input: any TAN document; a boolean indicating whether each element should be 
stamped with a unique id in @q; attributes that should be added to the root element 
Output: the TAN document, resolved, as explained in the associated loop function 
below 

Related: resolution, files

Used by variable $tan:annotations-resolved, $tan:see-alsos-resolved, $tan:predecessors-resolved, $tan:successors-resolved, $tan:self-resolved, $tan:redivisions-resolved, $tan:model-resolved, $tan:sources-resolved, $tan:morphologies-resolved.

Used by template ŧ tan:get-and-resolve-dependency, ŧ tan:check-referred-doc, ŧ tan:core-expansion-terse, ŧ tan:class-1-expansion-verbose-pass-1, ŧ tan:core-expansion-verbose.

Used by function tan:resolve-doc(), tan:update-TAN-change-log(), tan:resolve-doc-loop().

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

Option 1 (TAN-fn-resolve-files)

tan:resolve-href($xml-node as node()?) as node()?

One-parameter version of the full one, below 

Used by function tan:resolve-href(), tan:get-1st-doc().

Relies upon tan:resolve-href.

Option 2 (TAN-fn-resolve-files)

tan:resolve-href($xml-node as node()?, $add-q-ids as xs:boolean) as node()?

Two-parameter version of the full one, below 

Used by function tan:resolve-href(), tan:get-1st-doc().

Relies upon tan:base-uri, tan:resolve-href.

Option 3 (TAN-fn-resolve-files)

tan:resolve-href($xml-node as node()?, $add-q-ids as xs:boolean, $this-base-uri as xs:string) as node()?

Input: any XML node, a boolean, a string 
Output: the same node, but with @href in itself and all descendant elements resolved 
to absolute form, with @orig-href inserted preserving the original if there is a 
change 
The second parameter is provided because this function works closely with 
tan:resolve-doc(). 

Related: resolution, uris, filenames

Used by function tan:resolve-href(), tan:get-1st-doc().

Relies upon ŧ tan:resolve-href.

Option 1 (TAN-fn-search-extended)

tan:search-results-to-IRI-name-pattern($search-results as item()*) as item()*

One-parameter version of the fuller one, below 

Used by function tan:search-results-to-IRI-name-pattern().

Relies upon tan:search-results-to-IRI-name-pattern.

Option 2 (TAN-fn-search-extended)

tan:search-results-to-IRI-name-pattern($search-results as item()*, $format-results as xs:boolean) as item()*

Input: search results from tan:search-for-entities() 
Output: for every entity found, an <item> with <IRI>, <name>, and perhaps <desc> 
Note, this is intended to format results from searches that result in identifiers 
and descriptions of entities, not claims. 

Related: search, vocabulary

Used by function tan:search-results-to-IRI-name-pattern().

Relies upon ŧ tan:get-IRI-name.

TAN-fn-sequences-standard

tan:collate-pair-of-sequences($string-sequence-1 as xs:string*, $string-sequence-2 as xs:string*) as element()

Input: two sequences of strings 
Output: an element sequence that collates the two sequences as a single sequence, 
attempting to preserve the longest common subsequence. 
This function has been written for two different scenarios: 
1. @n values in two sets 
of <div>s that must be collated; 
2. pre-processing two long strings that need to be 
compared. Although the primary context is two sets of unique string-sequences, one could 
imagine situations where one or both input strings have repetition, in which case it is best 
to retain information about the sequence. Hence the output is a sequence of elements, 
with @p1, @p2, or both signifying the position of the original input. The transformation 
is lossless, and the original input can be reconstructed if needed. 

Related: grouping, sequences, strings, diff

Used by function tan:diff-courtyard(), tan:diff-loop(), tan:collate-pair-of-sequences(), tan:collate-sequence-loop().

Relies upon tan:array-to-xml, tan:collate-pair-of-sequences(), tan:longest-ascending-subsequence.

TAN-fn-sequences-standard

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

Input: a string representing a TAN selector (used by @pos, @chars), 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'. 
This function assumes that all numerals are Arabic. 

Related: sequences, numerics, numerals

Used by template ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:check-and-expand-ranges, ŧ tan:mark-dependencies-pass-2-for-validation, ŧ tan:evaluate-conditions.

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

TAN-fn-sequences-standard

tan:longest-ascending-subsequence($integer-sequence as item()*) as array(xs:integer+)?

Input: a sequence of items. Each item is either an integer, an array of integer 
sequences, or a sequence of integers serialized as text nodes (within child elements) 
Output: An array. Each member of the array is a sequence of two integers. The first 
represents the position of the output integer, and the second is the integer itself that is a 
member of the longest ascending subsequence. The positional first integer allows one to 
disambiguate repetitions in the input. 
Although this function claims by its name to find the longest subsequence, in the 
interests of efficiency, it applies the so-called Patience method of finding the string, 
which may return only a very long string, not the longest possible string. Such an approach 
allows the number of operations to be directly proportionate to the number of input values 
(backtracking would be computationally intensive on long sequences). The routine does 
"remember" gaps. If, given a set of integers, there is no increment available in candidate 
sequences, the sequences are retained, but a check is made backward for a subsequence that would 
account for the smallest of the new integers. 
The input allows a sequence of elements, along with integers, because this function 
has been written to support tan:collate-pairs-of-sequences(), which requires 
choice options. That is, you may have a situation where you are comparing two sequences, 
either of which may have values that repeat, e.g., (a, b, c, b, d) and (c, b, d). The first 
sequence is converted (1, 2, 3, 4, 5). In finding a corresponding sequence of integers for the 
second set, b must be allowed to be either 2 or 4, i.e., the array [3, (2, 4), 5]. Both items of 
input would ideally be expressed as arrays of integers, but this function serves an XSLT 
2.0 library (where arrays are not recognized), and arrays are not as easy to construct 
and extract in XSLT 3.0 as maps are. 
If an input array member consists of the empty sequence, its position impacts the 
positions that are returned in the output, but not the corresponding values (obviously). 

Related: items, sequences, numerics

Used by function tan:longest-ascending-subsequence(), tan:collate-pair-of-sequences().

Relies upon tan:longest-ascending-subsequence(), ŧ tan:build-integer-arrays.

TAN-fn-strings-extended

Definition: ('a', 'the')

Used by function tan:title-case().

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

TAN-fn-strings-standard

Definition: '[' || tan:escape(string-join($tan:nested-phrase-markers/tan:pair/tan:close/text())) || ']'

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

Relies upon $tan:nested-phrase-markers.

TAN-fn-strings-diff-standard

tan:adjust-diff($diff-output as element(tan:diff)*) as element()*

Input: any output <diff>s from tan:diff() 
Output: the output adjusted, with <a> and <b>s shifted if there are more optimal 
divisions 
Multiple inputs are presumed to be tan:diff() results that should be concatenated. 
This function is helpful for cases where the common element needs to be adjusted to 
better respect word or phrase boundaries. 

Related: strings, diff

Used by function tan:collate(), tan:replace-diff(), tan:adjust-diff().

Relies upon tan:adjust-diff(), tan:common-end-string, tan:common-start-string, ŧ tan:trim-or-add-text.

Option 1 (TAN-fn-strings-diff-extended)

tan:apply-deltas($string-to-convert as xs:string?, $deltas as document-node()*) as xs:string?

2-parameter version of the full one, below 

Used by function tan:apply-deltas().

Relies upon tan:apply-deltas.

Option 2 (TAN-fn-strings-diff-extended)

tan:apply-deltas($string-to-convert as xs:string?, $deltas as document-node()*, $input-is-string-a as xs:boolean?) as xs:string?

Input: a string, a series of delta documents, perhaps a boolean 
Output: another string, after any applicable deltas have been successively 
applied 
Each delta will be applied only once. If any deltas are left over, a warning will be 
returned. 
Output will be verified; if its checksum does not match what is in the given delta, a 
warning will be returned 

Related: strings, diff

Used by function tan:apply-deltas().

Relies upon tan:apply-deltas, tan:checksum-fletcher-64, tan:ellipses, tan:trim-long-tree.

TAN-fn-strings-extended

tan:batch-replace-advanced($items-with-strings as item()*, $replace-elements as element()*) as item()*

Input: any items; a sequence of elements: <[ANY NAME] pattern="" [flags=""] 
[message=""] [exclude-pattern=""]>[ANY CONTENT]</[ANY NAME]> 
Output: a sequence of items, with instances of @pattern replaced by the content of 
the elements 
This is a more advanced form of tan:batch-replace(), in that it allows text to be 
replaced by elements. It also allows for exclusion of matches via @exclude-pattern.. That is, 
if a span of text matches that value, the match will be ignored. 
The function was devised to convert raw text into TAN-T. Textual references can be 
turned into <div n=""/> anchors, and the result can then be changed into a traditional 
hierarchy. 

Related: strings, tree manipulation, nodes

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

Relies upon ŧ tan:batch-replace-advanced-pass-1.

TAN-fn-strings-diff-standard

tan:chop-diff-output($diff-output as element(tan:diff)?, $chop-points as xs:integer*, $use-string-a as xs:boolean, $chop-other-at-regex as xs:string?) as map(xs:integer, item()*)

Input: diff output; a sequence of integers; a boolean; a string 
Output: a map whose constituent map entries consist of the input chopped into parts 
according to the input sequence of integers. If the boolean is true, then chops will be made 
according to string a, with chops on b made proportionally, respecting the boundaries defined 
by the fourth parameter. 
Each map entry have as its value a <diff> wrapping the fragment <a>, <b>, <common>s. 
If the input diff output already has @_pos-a and the like already inside, those 
figures will be respected, otherwise string data will be stamped into the input, and will be 
preserved in the output. 
The numeral 1 will be automatically added to the chop points, and duplicates will be 
removed. 
If the chop regex for the other string is missing, the chops will occur on individual 
characters. 
This function was written primarily to support verbose validation of class 1 files, 
and to drive the application that synchronizes a class 1 file with a given redivision. 
This function provides a more complex approach to the generic one supported by 
tan:chop-tree() 

Related: strings, tree manipulation

Used by template ŧ tan:class-1-expansion-verbose-pass-3.

Used by function tan:chop-diff-output().

Relies upon $tan:char-regex, tan:chop-diff-output(), tan:stamp-diff-with-text-data, ŧ tan:split-diff-components-1.

Option 1 (TAN-fn-strings-standard)

tan:chop-string($input as xs:string?) as xs:string*

Input: any string 
Output: that string chopped into a sequence of individual characters, following 
TAN rules (modifying characters always join their preceding base character) 

Related: strings, sequences

Used by template ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:split-diff-components-1, ŧ tan:mark-dependencies-pass-2, ŧ tan:split-diff-components-2.

Used by function tan:atomize-string(), tan:chop-string(), tan:string-length(), tan:diff-loop(), tan:segment-string(), tan:int-to-grc(), tan:cardinal().

Relies upon $tan:char-regex.

Option 2 (TAN-fn-strings-standard)

tan:chop-string($input as xs:string?, $chop-after-regex as xs:string) as xs:string*

Input: any string 
Output: that string chopped into a sequence of individual characters, following 
TAN rules (modifying characters always join their preceding base character) 

Related: strings, sequences

Used by template ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:split-diff-components-1, ŧ tan:mark-dependencies-pass-2, ŧ tan:split-diff-components-2.

Used by function tan:atomize-string(), tan:chop-string(), tan:string-length(), tan:diff-loop(), tan:segment-string(), tan:int-to-grc(), tan:cardinal().

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

Option 3 (TAN-fn-strings-standard)

tan:chop-string($input as xs:string?, $chop-after-regex as xs:string) as xs:string*

2-param version of the full one below 

Used by template ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:split-diff-components-1, ŧ tan:mark-dependencies-pass-2, ŧ tan:split-diff-components-2.

Used by function tan:atomize-string(), tan:chop-string(), tan:string-length(), tan:diff-loop(), tan:segment-string(), tan:int-to-grc(), tan:cardinal().

Relies upon tan:chop-string.

Option 4 (TAN-fn-strings-standard)

tan:chop-string($input as xs:string?, $chop-after-regex as xs:string, $preserve-nested-clauses as xs:boolean) as xs:string*

Input: any string, a regular expression, a boolean 
Output: the input string cut into a sequence of strings using the regular expression 
as the cut marker 
If the last boolean is true, then nested clauses (parentheses, direct quotations, 
etc.) will be preserved. 
This function differs from the 1-parameter version in that it is used to chop the 
string not into individual characters but into words, clauses, sentences, etc. 

Related: strings

Used by template ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:split-diff-components-1, ŧ tan:mark-dependencies-pass-2, ŧ tan:split-diff-components-2.

Used by function tan:atomize-string(), tan:chop-string(), tan:string-length(), tan:diff-loop(), tan:segment-string(), tan:int-to-grc(), tan:cardinal().

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

Option 1 (TAN-fn-strings-collate-standard)

tan:collate($strings-to-collate as xs:string*, $string-labels as xs:string*, $preoptimize-string-order as xs:boolean) as element()?

3-parameter version of fuller one, below 

Used by template ŧ tan:clean-up-collation-pass-1.

Used by function tan:collate().

Relies upon tan:collate.

Option 2 (TAN-fn-strings-collate-standard)

tan:collate($strings-to-collate as xs:string*, $string-labels as xs:string*, $preoptimize-string-order as xs:boolean, $adjust-diffs-during-preoptimization as xs:boolean, $clean-up-collation as xs:boolean) as element()?

5-parameter version of fuller one, below 

Used by template ŧ tan:clean-up-collation-pass-1.

Used by function tan:collate().

Relies upon tan:collate.

Option 3 (TAN-fn-strings-collate-standard)

tan:collate($strings-to-collate as xs:string*, $string-labels as xs:string*, $preoptimize-string-order as xs:boolean, $adjust-diffs-during-preoptimization as xs:boolean, $clean-up-collation as xs:boolean, $snap-to-word as xs:boolean) as element()?

Input: a sequence of strings to be collated; a sequence of strings that label each 
string; a boolean indicating whether the sequence of input strings should be optimized; a 
boolean indicating whether the results of tan:diff() should be processed and weighed; a 
boolean indicating whether the collation should be cleaned up; a boolean whether diffs 
should be processed word for word or not. 
Output: a <collation> with (1) one <witness> per string (and if the last parameter is 
true, then a sequence of children <commonality>s, signifying how close that string is 
with every other, and (2) a sequence of <c>s and <u>s, each with a <txt> and one or more <wit 
ref="" pos=""/>, indicating which string witness attests to the [c]ommon or [u]nique 
reading, and what position in that string the particular text fragment starts at. 
If there are not enough labels (2nd parameter) for the input strings, the numerical 
position of the input string will be used as the string label / witness id. 
If the third parameter is true, then tan:diff() will be performed against each pair 
of strings. Each diff output will be weighed by closeness of the two texts, and sorted 
accordingly. The results of this operation will be stored in collation/witness/commonality. 
This requires (n-1)! operations, so should be efficient for a few input strings, but will 
grow progressively longer according to the number and size of the input strings. 
Preoptimizing strings will likely produces greater congruence in the <u> fragments. 
If the last parameter is true, then cleanup will not be performed. This parameter was 
introduced because the cleanup process itself invokes tan:collate() and one does not want to 
get into an endless loop because of a mishmash of differences that can never be 
reconciled or brought closer together. 
This version of tan:collate was written in XSLT 3.0 to take advantage of 
xsl:iterate, and has an arity of 3, 5, or 6 parameters, unlike its XSLT 2.0 predecessors, which also 
applied a different approach to collation. 
Changes in output from previous version of tan:collate(): 
- @w is now <wit> with 
@ref and @pos 
- the text node of <u> or <c> is now wrapped in <txt> 
- @length is ignored (the 
value is easily calculated) With these changes, any witness can be easily reconstructed 
with the XPath expression tan:collation/() 

Related: strings, diff

Used by template ŧ tan:clean-up-collation-pass-1.

Used by function tan:collate().

Relies upon tan:adjust-diff, tan:collate(), tan:diff-cache, tan:diff-to-collation, tan:trim-long-text, ŧ tan:clean-up-collation-pass-1, ŧ tan:clean-up-collation-pass-2.

Option 1 (TAN-fn-strings-extended)

tan:commas-and-ands($input-strings as xs:string*) as xs:string?

One-parameter version of the full one below 

Used by function tan:commas-and-ands().

Relies upon tan:commas-and-ands.

Option 2 (TAN-fn-strings-extended)

tan:commas-and-ands($input-strings as xs:string*, $oxford-comma as xs:boolean) as xs:string?

Input: sequences of strings 
Output: the strings joined together with , and 'and' 

Related: strings

Used by function tan:commas-and-ands().

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

TAN-fn-strings-standard

tan:contains-only-once($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean

Input: any two strings 
Output: true() if and only if the first string contains the second, only one time 
This function was introduced to support tan:diff(), to ensure that unique common 
tokens between two strings are not substrings of any other unique common tokens. 

Related: strings

Used by function tan:diff-courtyard(), tan:diff-loop().

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

Option 1 (TAN-fn-strings-diff-standard)

tan:diff($string-a as xs:string?, $string-b as xs:string?) as element()

2-param version of fuller one below 

Used by template ŧ tan:class-1-expansion-verbose-pass-1, ŧ tan:core-expansion-normal.

Used by function tan:diff(), tan:diff-cache(), tan:diff-courtyard(), tan:giant-diff(), tan:replace-collation(), tan:get-diff-output-transpositions(), tan:replace-diff(), tan:diff-loop(), tan:replace-expanded-class-1-body(), tan:diff-or-collate-to-html().

Relies upon tan:diff.

Option 2 (TAN-fn-strings-diff-standard)

tan:diff($string-a as xs:string?, $string-b as xs:string?, $snap-to-word as xs:boolean) as element()

3-param version of fuller one below 

Used by template ŧ tan:class-1-expansion-verbose-pass-1, ŧ tan:core-expansion-normal.

Used by function tan:diff(), tan:diff-cache(), tan:diff-courtyard(), tan:giant-diff(), tan:replace-collation(), tan:get-diff-output-transpositions(), tan:replace-diff(), tan:diff-loop(), tan:replace-expanded-class-1-body(), tan:diff-or-collate-to-html().

Relies upon tan:diff.

Option 3 (TAN-fn-strings-diff-standard)

tan:diff($string-a as xs:string?, $string-b as xs:string?, $snap-to-word as xs:boolean, $preprocess-long-strings as xs:boolean) as element()

Input: any two strings; boolean indicating whether results should snap to nearest 
word; boolean indicating whether long strings should be pre-processed 
Output: an element with <a>, <b>, and <common> children showing where strings a and b 
match and depart 
This function was written to assist the validation of <redivision>s quickly find 
differences between any two strings. The function has been tested on pairs of strings up to 
combined lengths of 9M characters. At that scale, the only way to efficiently process the 
diffs is by chaining smaller diffs, which are still large, optimally about 350K in length. 
This function prepares strings for 5-arity tan:diff-engine(), primarily by 
tending to input strings that are large or really large (giant). Large pairs of strings are 
parsed to find common characters that might be used to find pairwise congruence of large 
segments. Giant pairs of strings are passed to tan:giant-diff(). 

Related: strings, diff

Used by template ŧ tan:class-1-expansion-verbose-pass-1, ŧ tan:core-expansion-normal.

Used by function tan:diff(), tan:diff-cache(), tan:diff-courtyard(), tan:giant-diff(), tan:replace-collation(), tan:get-diff-output-transpositions(), tan:replace-diff(), tan:diff-loop(), tan:replace-expanded-class-1-body(), tan:diff-or-collate-to-html().

Relies upon tan:diff(), tan:ellipses.

TAN-fn-strings-diff-standard

tan:diff-to-collation($diff-output as element()?, $diff-text-a-label as xs:string?, $diff-text-b-label as xs:string?) as element()

Input: any single output of tan:diff(), two strings for the labels of diff strings a 
and b 
Output: the output converted to the output of tan:collate(), namely, a <collation> 
with <u> and <c> children, wrapping <txt>, <wit>. 
This function was written to support the XSLT 3.0 version of tan:collate(), to allow 
tan:diff() to be merged with tan:collate() output 

Related: strings, diff

We leave a marker for both witnesses in every <a> or <b>, but marking one as <wit> and 
another as <x>. This will facilitate the grouping of collations. 

Used by function tan:collate().

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

TAN-fn-strings-diff-extended

tan:diff-to-delta($diff-output as element(tan:diff)?) as document-node()?

Input: any output from tan:diff() 
Output: a document node registering only the difference between strings a and b 
Delta files are structured to support two-way conversion. That is, they are 
designed such that b can be reconstituted from a or vice versa. See tan:apply-deltas() for 
documentation. 

Related: diff, strings

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

Relies upon ŧ tan:diff-to-delta.

Option 1 (TAN-fn-strings-standard)

tan:ellipses($strings-to-truncate as xs:string*, $string-length-to-retain as xs:integer) as xs:string*

2-arity version of the fuller one, below 

Used by template ŧ tan:adjust-horizontal-search, ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:ellipses.

Used by function tan:ellipses(), tan:diff-courtyard(), tan:giant-diff(), tan:get-diff-output-transpositions(), tan:md5(), tan:common-start-or-end-string(), tan:diff-loop(), tan:infuse-tree(), tan:diff(), tan:apply-deltas(), tan:checksum-fletcher(), tan:diff-or-collate-to-html().

Relies upon tan:ellipses.

Option 2 (TAN-fn-strings-standard)

tan:ellipses($strings-to-truncate as xs:string*, $string-length-to-retain as xs:integer, $terminal-string-length-to-retain as xs:integer) as xs:string*

3-arity version of the fuller one, below 

Used by template ŧ tan:adjust-horizontal-search, ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:ellipses.

Used by function tan:ellipses(), tan:diff-courtyard(), tan:giant-diff(), tan:get-diff-output-transpositions(), tan:md5(), tan:common-start-or-end-string(), tan:diff-loop(), tan:infuse-tree(), tan:diff(), tan:apply-deltas(), tan:checksum-fletcher(), tan:diff-or-collate-to-html().

Relies upon tan:ellipses.

Option 3 (TAN-fn-strings-standard)

tan:ellipses($strings-to-truncate as xs:string*, $initial-string-length-to-retain as xs:integer, $terminal-string-length-to-retain as xs:integer, $indicate-number-of-characters-elided as xs:boolean) as xs:string*

Input: any sequence of strings; two integers; a boolean 
Output: the sequence of strings, but with any initial substring beyond the first 
requested length and any terminal substring beyond the last requested length replaced by 
ellipses. If the boolean is true, then two sets of ellipses will be provided, surrounding in 
square brackets the number of characters removed. 
If the elision is less than the length of the replacement, then no elision will take 
place. 
Examples: "abcd", 1, 1, false > "a…d" "abcd", 1, 1, true > "abcd" "abcdefghijk", 1, 1, 
true > "a…[9]…k" 

Related: strings

Used by template ŧ tan:adjust-horizontal-search, ŧ tan:core-expansion-terse tan:dependency-adjustments-pass-1, ŧ tan:ellipses.

Used by function tan:ellipses(), tan:diff-courtyard(), tan:giant-diff(), tan:get-diff-output-transpositions(), tan:md5(), tan:common-start-or-end-string(), tan:diff-loop(), tan:infuse-tree(), tan:diff(), tan:apply-deltas(), tan:checksum-fletcher(), tan:diff-or-collate-to-html().

Relies upon tan:ellipses().

TAN-fn-strings-collate-extended

tan:get-collate-stats($collate-input as element()?, $include-venns as xs:boolean) as element()?

Input: any output from tan:collate(); boolean 
Output: the output, wrapped in a <group> and preceded by statistics. If the boolean 
is true, then 3-way venn statistics will be included. 
For details, see comments at tan:infuse-diff-and-collate-stats(). 

Related: strings

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

Relies upon ŧ tan:get-diff-stats.

TAN-fn-strings-diff-extended

tan:get-diff-output-transpositions($diff-output as element(tan:diff), $minimum-transposition-length as xs:integer, $minimum-commonality as xs:decimal) as element()

Input: output from tan:diff(); an integer; a decimal (from 0 to 1) 
Output: a <transpositions> element, wrapping the following: (1) a <checksums> 
element that contains the checksums for strings a and b of the input; (2) a <parameters> 
element that contains the settings specified; (3) zero or more <transposition> elements 
wrapping the portion of the input diff output that is at least as long as the integer, and whose 
commonality is greater than or equal to the percent specified by the decimal. 
This function looks within likely sections of the results of tan:diff() for 
passages that may represent a transposition. What constitutes a transposition differs 
greatly from one situation to the next. In large stretches of running prose, a safe minimum 
length might be 20 and a corresponding commonality 0.95, to accommodate very occasional 
changes. The lower the commonality number, the more results, but they may include on the edges 
material that is not part of the actual transposition. 
<transposition> has attributes that point to the absolute position of the start of 
the a and b fragments within the original diff output. These values can be used as points 
at which to chop the diff result tree, if you wish to synthesize, combine, etc. it with 
the transposition slices. 
Transpositions can be a difficult topic, with many-to-many assignments between 
the two texts, or with assignments in the same text that overlap. This is normal, and 
reflects normal editing habits. For example, an editor may take two sentences from different 
parts of a text and merge them at a third spot. This function, with enough leeway in the 
parameters, would catch both of the transpositions. It is up to you to interpret those 
transpositions and use them as you see fit. 

Related: strings, diff

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

Relies upon tan:checksum-fletcher-64, tan:diff, tan:ellipses, tan:map-to-xml, tan:stamp-diff-with-text-data, ŧ tan:strip-text-data-stamps.

TAN-fn-strings-diff-extended

tan:get-diff-stats($diff-input as element()?) as element()?

Input: any output from tan:diff() 
Output: the output, wrapped in a <group> and preceded by statistics. 
For details, see comments at tan:infuse-diff-and-collate-stats(). 

Related: diff, statistics

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

Relies upon ŧ tan:get-diff-stats.

TAN-fn-strings-diff-extended

tan:lcs-distance($diff-output as element(tan:diff)?) as xs:integer?

Input: results of tan:diff() 
Output: the longest common subsequence distance of the output 
LCS distance assigns 1 point per character deletion and insertion 

Related: strings, diff

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

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

TAN-fn-strings-diff-extended

tan:levenshtein-distance($diff-output as element(tan:diff)?) as xs:integer?

Input: results of tan:diff() 
Output: the Levenstein distance of the output 
Levenstein distance assigns 1 point per character deletion, insertion, or 
substitution 

Related: strings, diff

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

Relies upon ŧ tan:levenshtein-distance.

Option 1 (TAN-fn-strings-standard)

tan:normalize-div-text($single-leaf-div-text-nodes as xs:string*) as xs:string*

One-parameter version of the fuller one, below. 

Used by template ŧ tan:tokenize-div, ŧ tan:text-join.

Used by function tan:normalize-div-text().

Relies upon tan:normalize-div-text.

Option 2 (TAN-fn-strings-standard)

tan:normalize-div-text($single-leaf-div-text-nodes as xs:string*, $remove-special-div-end-chars as xs:boolean) as xs:string*

Input: any sequence of strings, presumed to be text nodes of a single leaf div; a 
boolean indicating whether special div-end characters should be retained or not 
Output: the same sequence, normalized according to TAN rules. Each item in the 
sequence is space normalized and then if its end matches one of the special div-end 
characters, ZWJ U+200D or SOFT HYPHEN U+AD, the character is removed; otherwise a space is added 
at the end. Zero-length strings are skipped. 
This function is designed specifically for TAN's commitment to nonmixed content. 
That is, every TAN element contains either elements or non-space text but not both, which 
also means that space-only text nodes are effectively ignored. It is assumed that every 
TAN element is followed by a notional space. 
The second parameter is important, because output will be used to normalize and 
repopulate leaf <div>s (where special div-end characters should be retained) or to 
concatenate leaf <div> text (where those characters should be deleted) 

Related: strings

Used by template ŧ tan:tokenize-div, ŧ tan:text-join.

Used by function tan:normalize-div-text().

Relies upon $tan:special-end-div-chars-regex, tan:normalize-div-text().

Option 1 (TAN-fn-strings-standard)

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

one-parameter version of full function below 

Used by template ŧ tan:check-referred-doc.

Used by function tan:normalize-text(), tan:normalize-name().

Relies upon tan:normalize-text.

Option 2 (TAN-fn-strings-standard)

tan:normalize-text($text as xs:string*, $treat-as-name-values as xs:boolean) as xs:string*

Input: any sequence of strings; a boolean indicating whether the results should be 
name-normalized 
Output: that sequence, with each item's space normalized, and removal of any help 
requested 
In name-normalization, the string is converted to lower-case, and spaces replace 
hyphens, underscores, and illegal characters. 
Special end div characters are not removed in this operation, nor is tail-end space 
adjusted according to TAN rules; for that, see tan:normalize-div-text(). 

Related: strings

Used by template ŧ tan:check-referred-doc.

Used by function tan:normalize-text(), tan:normalize-name().

Relies upon $tan:help-trigger-regex, $tan:regex-characters-not-permitted, $tan:regex-name-space-characters.

TAN-fn-strings-collate-extended

tan:replace-collation($original-witness-string as xs:string?, $original-witness-id as xs:string?, $collate-output-to-replace as element()?) as element()?

Input: two strings; the output of tan:collate() 
Output: the output, but an attempt is made to change every <c> and every <u> with the 
chosen witness id (param 2) into the original string form (param 1). 
This is a companion function to tan:replace-diff(), but it has some inherent 
limitations. Diffs of 3 or more sources can be messy, and any attempt to replace every <u> with a 
particular version proves to be confusing to interpret. Furthermore, tan:replace-diff() 
adjusts the output so that newly inserted characters are not repeated if they are applied 
equally to coordinate <a>s and <b>s. That is not possible for collate because of how chaotic 
the results can be. So the fallback method is to focus on getting the first witness right, 
and not worrying about the others. 
If the 2nd parameter is empty or doesn't match a particular witness id, then the first 
witness will be chosen. Intentionally supplying a bad 2nd parameter can be a good idea, if you 
are interested in only the dominant source, since tan:collate() by default places at 
the top the witness with the least amount of divergence. 
Because only one witness is being recalibrated, it is possible to update the 
position values. But the other witness values will not be updated, so that the results can be 
correlated with the other witness texts if needed. Further, if a replacement involves that 
witness no longer attesting to that fragment, then it is changed to a <u> (or the <u> is 
retained) and the <wit> is dropped. 

Related: strings, diff

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

Relies upon tan:diff, ŧ tan:replace-collation.

TAN-fn-strings-diff-extended

tan:replace-diff($original-string-a as xs:string?, $original-string-b as xs:string?, $diff-to-replace as element()?, $prioritize-a-over-b as xs:boolean) as element()?

Input: the results of tan:diff(); the original a and b strings; a boolean 
Output: the output, but with each <a>, and <b> replaced by the original strings. 
<common> follows the a string, not b. 
This function was made to support a more relaxed approach to tan:diff(), one that 
avoids changes that should be ignored. For example, if you are comparing "Gray" (=$a) and 
"greys" (=$b) and for your purposes, alternate spellings and case should be ignored, then 
make appropriate changes to the strings (=$a2, $b2) then tan:reconcile-diff($a, $b, 
tan:diff$a2, $b2)) will result in <diff><common>Gray</common><b>s</b></diff> 

Related: strings, diff

Used by function tan:replace-diff().

Relies upon tan:adjust-diff, tan:diff, tan:map-to-xml, tan:replace-diff(), tan:stamp-diff-with-text-data, ŧ tan:replace-diff, ŧ tan:shallow-skip-diff-add.

Option 1 (TAN-fn-strings-extended)

tan:satisfies-regexes($string-to-test as xs:string?, $string-must-match-regex as xs:string?, $string-must-not-match-regex as xs:string?) as xs:boolean

3-param version of fuller one, below 

Used by function tan:satisfies-regex(), tan:filename-satisfies-regex(), tan:satisfies-regexes(), tan:filename-satisfies-regexes().

Relies upon tan:satisfies-regexes.

Option 2 (TAN-fn-strings-extended)

tan:satisfies-regexes($string-to-test as xs:string?, $string-must-match-regex as xs:string?, $string-must-not-match-regex as xs:string?, $flags as xs:string?) as xs:boolean

Input: a string value; an optional regex the string must match; an optional regex the 
string must not match 
Output: whether the string satisfies the two regex conditions; if either regex is 
empty, true will be returned 
If the input string is less than zero length, the function returns false 

Related: strings, regular expressions

Used by function tan:satisfies-regex(), tan:filename-satisfies-regex(), tan:satisfies-regexes(), tan:filename-satisfies-regexes().

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

Option 1 (TAN-fn-strings-extended)

tan:segment-string($string-to-segment as xs:string?, $segment-portions as xs:decimal*) as xs:string*

2-arity version of the more complete function, below 

Used by function tan:segment-string(), tan:infuse-tree().

Relies upon tan:segment-string.

Option 2 (TAN-fn-strings-extended)

tan:segment-string($string-to-segment as xs:string?, $segment-portions as xs:decimal*, $break-at-regex as xs:string) as xs:string*

Input: a string, a sequence of doubles from 0 through 1, a regular expression 
Output: the string divided into segments proportionate to the doubles, with 
divisions allowed only by the regular expression 

Related: strings, sequences

Used by function tan:segment-string(), tan:infuse-tree().

Relies upon tan:chop-string.

TAN-fn-strings-diff-standard

tan:stamp-diff-with-text-data($diff-result as element(tan:diff)?) as item()*

Input: any output from tan:diff() 
Output: each <diff> child stamped with @_len, @_pos-a, @_pos-b indicating length 
and the starting positions for a and b 
This function produces output analogous to tan:stamp-tree-with-text-data() 

Related: strings, tree manipulation, attributes

Used by template ŧ tan:infuse-diff-and-collate-stats, ŧ tan:class-1-expansion-verbose-pass-1, ŧ diff-or-collate-to-html-output-pass-1.

Used by function tan:diff-a-map(), tan:get-diff-output-transpositions(), tan:replace-diff(), tan:chop-diff-output(), tan:get-diff-output-slices().

Relies upon ŧ tan:stamp-diff-with-text-data.

Option 1 (TAN-fn-strings-standard)

tan:text-join($items as item()*) as xs:string?

one-parameter version of the full function below 

Used by template ŧ tan:text-join, ŧ tan:merge-divs, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:text-join().

Relies upon tan:text-join.

Option 2 (TAN-fn-strings-standard)

tan:text-join($items as item()*, $set-divs-on-new-line as xs:boolean) as xs:string?

Input: any document fragment of a TAN class 1 body, whether raw or resolved 
Output: a single string that joins and normalizes the leaf div text according to TAN 
rules 
All special leaf-div-end characters will be stripped including the last 
Do not apply this function to class-1 files that have been expanded, because 
normalization will have already occurred. 
Do not apply this function to TEI elements within leaf divs. 

Related: strings, nodes

Used by template ŧ tan:text-join, ŧ tan:merge-divs, ŧ tan:class-1-expansion-verbose-pass-1.

Used by function tan:text-join().

Relies upon ŧ tan:text-join.

TAN-fn-strings-standard

tan:tokenize-div($input as item()*, $token-definitions as element(tan:token-definition)) as item()*

Input: any items, a <token-definition> 
Output: the items with <div>s in tokenized form 

Related: strings

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

Relies upon ŧ tan:tokenize-div.

Option 1 (TAN-fn-strings-standard)

tan:tokenize-text($text as xs:string*) as element()*

one-parameter version of the function below 

Used by template ŧ tan:dependency-adjustments-pass-2, ŧ tan:mark-dependencies-for-validation, ŧ tan:tokenize-div, ŧ tan:mark-dependencies-pass-1, ŧ tan:dependency-expansion-normal, ŧ tan:dependency-expansion-verbose.

Used by function tan:tokenize-text().

Relies upon $tan:token-definition-default, tan:tokenize-text.

Option 2 (TAN-fn-strings-standard)

tan:tokenize-text($text as xs:string*, $token-definition as element(tan:token-definition)?, $count-toks as xs:boolean?) as element()*

three-parameter version of the function below 

Used by template ŧ tan:dependency-adjustments-pass-2, ŧ tan:mark-dependencies-for-validation, ŧ tan:tokenize-div, ŧ tan:mark-dependencies-pass-1, ŧ tan:dependency-expansion-normal, ŧ tan:dependency-expansion-verbose.

Used by function tan:tokenize-text().

Relies upon tan:tokenize-text.

Option 3 (TAN-fn-strings-standard)

tan:tokenize-text($text as xs:string*, $token-definition as element(tan:token-definition)?, $count-toks as xs:boolean?, $add-attr-q as xs:boolean?, $add-attr-pos as xs:boolean?) as element()*

Input: any number of strings; a <token-definition>; a boolean indicating whether 
tokens should be counted and labeled. 
Output: a <result> for each string, tokenized into <tok> and <non-tok>, 
respectively. If the counting option is turned on, the <result> contains @tok-count and 
@non-tok-count, and each <tok> and <non-tok> have an @n indicating which <tok> group it belongs to. 

Related: strings, sequences

Used by template ŧ tan:dependency-adjustments-pass-2, ŧ tan:mark-dependencies-for-validation, ŧ tan:tokenize-div, ŧ tan:mark-dependencies-pass-1, ŧ tan:dependency-expansion-normal, ŧ tan:dependency-expansion-verbose.

Used by function tan:tokenize-text().

Relies upon $tan:token-definition-default, tan:tokenize-text(), ŧ tan:add-tok-pos, ŧ tan:first-stamp-shallow-copy.

TAN-fn-strings-standard

tan:unique-char($context-strings as xs:string*) as xs:string?

Input: any sequence of strings 
Output: a single character that is not to be found in those strings 
This function, written to support tan:collate-sequences(), provides unique way 
to join any sequence strings in such a way that it can later be tokenized. 

Related: strings

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

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

TAN-fn-time

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

Input: any TAN document 
Output: a sequence of elements with @when, @ed-when, @accessed-when, 
@claim-when, 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 

Related: versioning

Used by variable $tan:doc-history.

Used by template ŧ tan:check-referred-doc, ŧ tan:core-expansion-normal.

Used by function tan:last-change-agent().

Relies upon ŧ tan:get-doc-history.

Option 1 (TAN-fn-uris-standard)

tan:collection($catalog-docs as document-node()*) as document-node()*

One-parameter version of the master one, below 

Used by template ŧ tan:core-expansion-verbose.

Used by function tan:collection().

Relies upon tan:collection.

Option 2 (TAN-fn-uris-standard)

tan:collection($catalog-docs as document-node()*, $root-names as xs:string*, $id-matches as xs:string?, $href-matches as xs:string?) as document-node()*

Input: one or more catalog.tan.xml files; filtering parameters 
Output: documents that are available 

Related: uris, filenames

Used by template ŧ tan:core-expansion-verbose.

Used by function tan:collection().

Relies upon tan:base-uri.

Option 1 (TAN-fn-uris-extended)

tan:get-uuid()

zero-param version of the full one below 

Used by function tan:get-uuid().

Relies upon tan:get-uuid.

Option 2 (TAN-fn-uris-extended)

tan:get-uuid($quantity as xs:integer) as xs:string*

Input: a digit 
Output: that digit's quantity of UUIDs 
Code courtesy D. Novatchev, 
https://stackoverflow.com/questions/8126963/xslt-generate-uuid/64792196#64792196 

Related: uris

Used by function tan:get-uuid().

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

TAN-fn-uris-extended

tan:relativize-hrefs($input-items as item()*, $target-base-uri-resolved as xs:string) as item()*

Input: any items; a resolved base uri (target) 
Output: the items, with links in standard attributes such as @href changed so as to be 
relative to the target base uri. 
This function is intended to serve output that is going to a particular destination, 
and that needs to have links to nearby resources revised to their relative form. 

Related: uris, filenames, tree manipulation

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

Relies upon tan:uri-is-relative, ŧ tan:relativize-hrefs.

Option 1 (TAN-fn-uris-standard)

tan:uri-relative-to($uri-to-revise as xs:string?, $uri-to-revise-against as xs:string?) as xs:string?

2-parameter version of the one below 

Used by template ŧ tan:revise-hrefs, ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:relativize-hrefs.

Used by function tan:uri-relative-to(), tan:update-TAN-change-log(), tan:get-1st-doc().

Relies upon tan:uri-relative-to.

Option 2 (TAN-fn-uris-standard)

tan:uri-relative-to($uri-to-revise as xs:string?, $uri-to-revise-against as xs:string?, $base-uri as xs:string?) as xs:string?

Input: two strings representing URIs; a third representing the base against which 
the first two should be resolved 
Output: the first string in a form relative to the second string 
This function looks for common paths within two absolute URIs and tries to convert 
the first URI as a relative path 

Related: uris, filenames

Used by template ŧ tan:revise-hrefs, ŧ tan:core-expansion-terse-attributes-to-elements, ŧ tan:relativize-hrefs.

Used by function tan:uri-relative-to(), tan:update-TAN-change-log(), tan:get-1st-doc().

Relies upon tan:is-valid-uri, tan:uri-relative-to().

TAN-fn-vocabulary

tan:has-vocab($attr-to-check as attribute()?, $ids-and-names as xs:string*) as xs:boolean

Input: an attribute; a string 
Output: true if at least one value of the attribute points to vocabulary items that 
have an <id> or <name> that is identical to the 2nd parameter. 
The local vocabulary will be checked. If no vocabulary is returned, a check will be 
made based upon the standard TAN vocabulary 
This was written to make XPath predicate expressions easier. 

Related: vocabulary

Used by function tan:update-TAN-change-log().

Relies upon $tan:TAN-vocabularies, tan:attribute-vocabulary, tan:normalize-name, tan:vocabulary.

Option 1 (TAN-fn-vocabulary)

tan:vocabulary($target-element-names as xs:string*, $target-values as xs:string*) as element()*

2-param version of fuller one below 

Used by variable $tan:self-expanded-vocabulary, $tan:doc-vocabulary.

Used by template ŧ tan:tan-a-lm-expansion-terse, ŧ tan:core-expansion-terse-attributes, ŧ tan:mark-dependencies-pass-1, ŧ tan:core-expansion-terse.

Used by function tan:vocabulary(), tan:update-TAN-change-log(), tan:has-vocab(), tan:morphological-code-conversion-maps(), tan:attribute-vocabulary(), tan:last-change-agent().

Relies upon $tan:doc-vocabulary, tan:vocabulary.

Option 2 (TAN-fn-vocabulary)

tan:vocabulary($target-element-names as xs:string*, $target-values as xs:string*, $resolved-vocabulary-ancestors as element()*) as element()*

Input: two sequences of zero or more strings; a sequence of elements representing 
the ancestor of vocabulary in a resolved TAN file 
Output: the vocabulary items for the particular elements whose names match the 
first sequence and whose id, alias, or name values match the second sequence, found in 
descendants of the elements provided by the third sequence 
If either of the first two sequences are empty, or have an *, it is assumed that all 
possible values are sought. Therefore if the first two parameters are empty, the entire 
vocabulary will be returned 
The second parameter is assumed to have one value per item in the sequence. This is 
mandatory because it is designed to take two different types of values: @which (which is a 
single value and permits spaces) and other attributes (can be multiple values, 
space-delimited) 
If you approach this function with an attribute that points to elements, and you must 
first to retrieve that attribute's elements, you should run 
tan:target-element-names() beforehand to generate a list of element names that should be targeted 
It is assumed that the elements are the result of a fully resolved TAN file. 
If a value matches id or alias, no matches on name will be sought (locally redefined 
ids override name values) 
This function does not mark apparant errors, e.g., vocabulary items missing, or 
more than one for a single value 
If you are trying to work with vocabulary from an included document, the 
$resolved-vocabulary-ancestors should point exclusively to content (not self) of the appropriate resolved 
tan:include 

Related: vocabulary

Used by variable $tan:self-expanded-vocabulary, $tan:doc-vocabulary.

Used by template ŧ tan:tan-a-lm-expansion-terse, ŧ tan:core-expansion-terse-attributes, ŧ tan:mark-dependencies-pass-1, ŧ tan:core-expansion-terse.

Used by function tan:vocabulary(), tan:update-TAN-change-log(), tan:has-vocab(), tan:morphological-code-conversion-maps(), tan:attribute-vocabulary(), tan:last-change-agent().

Relies upon tan:distinct-items, tan:normalize-name, tan:vocabulary(), ŧ tan:vocabulary-all-vals, ŧ tan:vocabulary-by-id, ŧ tan:vocabulary-by-name.

TAN-fn-function-diagnostics

Definition: for $i in $tan:function-collection/collection/doc/@href, $j in resolve-uri($i, $tan:function-collection-base-uri) return if (doc-available($j)) then doc($j) else ()

Used by function tan:errors-checked-where(), tan:variables-checked-where().

Relies upon $tan:function-collection, $tan:function-collection-base-uri.

TAN-fn-schema-diagnostics

Definition: $tan:rng-collection[not(matches(base-uri(.), 'TAN-TEI'))]

Used by function tan:get-parent-elements().

Relies upon $tan:rng-collection.

TAN-core-errors

Definition: doc('TAN-errors.xml')

Used by variable $tan:errors-to-squelch.

Used by template ŧ tan:imitate-validation, ŧ tan:element-to-error.

Used by function tan:error().

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

TAN-core-errors

Definition: $tan:errors/tan:errors/tan:squelch[@phase = $tan:default-validation-phase]/tan:error-id

Used by template ŧ tan:imitate-validation.

Relies upon $tan:errors.

TAN-core-errors

Definition: tan:escape($tan:help-trigger)

Used by template ŧ tan:core-expansion-terse-attributes.

Used by function tan:normalize-text(), tan:help-extracted().

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