TAN-class-1-functions
Definition: tan:get-1st-doc($head/tan:model[1])
Used by variable $model-resolved
.
Relies upon $head
, tan:get-1st-doc()
.
TAN-class-1-functions
Definition: tan:resolve-doc($model-1st-da, false(), tan:attr('relationship', 'model'))
Used by template ŧ core-expansion-terse
, ŧ class-1-expansion-verbose-pass-1
.
Relies upon $model-1st-da
, tan:attr()
, tan:resolve-doc()
.
TAN-class-1-functions
Definition: tan:get-1st-doc($head/tan:redivision)
Used by variable $redivisions-resolved
.
Relies upon $head
, tan:get-1st-doc()
.
TAN-class-1-functions
Definition: for $i in $redivisions-1st-da return tan:resolve-doc($i, false(), tan:attr('relationship', 'redivision'))
Used by template ŧ core-expansion-terse
, ŧ class-1-expansion-verbose-pass-1
.
Relies upon $redivisions-1st-da
, tan:attr()
, tan:resolve-doc()
.
TAN-class-1-functions
Definition: ($zwj, $dhy, $zwsp)
Used by variable $special-end-div-chars-regex
.
Used by template ŧ dependency-adjustments-pass-1
, ŧ tokenize-div
.
Used by function tan:normalize-div-text()
.
TAN-class-1-functions
Definition: concat('\s*[', string-join($special-end-div-chars, ''), ']\s*$')
Used by template ŧ dependency-adjustments-pass-1
, ŧ tokenize-div
.
Used by function tan:normalize-div-text()
.
Relies upon $special-end-div-chars
.
TAN-class-1-functions
Looks for elements matching tan:div
Used by template ŧ class-1-expansion-verbose-pass-2
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions
Looks for elements matching tan:div
Used by function tan:expand-doc()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions
Looks for elements matching tan:tok
Used by template ŧ mark-dependencies-pass-2-for-validation
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions
tan:analyze-leaf-div-string-length($document-fragment as item()*) as item()*
Input: any class 1 document fragment, or result of tan:diff()
Output: Every leaf div or common/a/b stamped with@string-length
and@string-pos
, indicating how long the text node is, and where it is relative to all other leaf text nodes, after TAN text normalization rules have been applied.
This function is useful for statistical processing, and for comparing a TAN-T(
EI)
file against a redivision.
It has also been designed to stamp the<a>
and<common>
results oftan:diff()
, to facilitate SQFs that replace a text with that of the other version.
This function does the same thing as tan:analyze-string-length()
, but approaches
the problem with a recursive loop
Used by template ŧ class-1-expansion-verbose-pass-1
.
Relies upon tan:analyze-leaf-div-text-length-loop()
.
TAN-class-1-functions
tan:analyze-leaf-div-text-length-loop($items-to-process as item()*, $char-count-so-far as xs:integer, $return-final-count as xs:boolean) as item()*
Loop function for the master one, above.
Used by function tan:analyze-leaf-div-string-length()
, tan:analyze-leaf-div-text-length-loop()
.
Relies upon tan:analyze-leaf-div-text-length-loop()
, tan:normalize-div-text()
, tan:string-length()
.
Option 1 (TAN-class-1-functions)
tan:analyze-string-length($resolved-class-1-doc-or-fragment as item()*) as item()*
One-parameter function of the two-parameter version below
Used by function tan:analyze-string-length()
.
Relies upon tan:analyze-string-length()
.
Option 2 (TAN-class-1-functions)
tan:analyze-string-length($resolved-class-1-doc-or-fragment as item()*, $mark-only-leaf-divs as xs:boolean) as item()*
Input: any class-1 document or fragment (or a result of tan:diff()
); an indication
whether string lengths should be added only to leaf divs, or to every div.
Output: the same document, with@string-length
and@string-pos
added to every element
Function to calculate string lengths of each leaf elements and their relative position, so that a raw text can be segmented proportionately and given the structure of a model exemplar. NB: any$special-end-div-chars
that terminates a<div>
not only will not be counted, but the assumed space that follows will also not be counted. On the other hand, the lack of a special character at the end means that the nominal space that follows a div will be included in both the length and the position. Thus input... <div type="m" n="1">abc­</div> <div type="m" n="2">def‍</div> <div type="m" n="3">ghi</div> <div type="m" n="4">xyz</div> ...presumes a raw joined text of "abcdefghi xyz ", and so becomes output: <div type="m" n="1" string-length="3" string-pos="1">abc­</div> <div type="m" n="2" string-length="3" string-pos="4">def‍</div> <div type="m" n="3" string-length="4" string-pos="7">ghi</div> <div type="m" n="4" string-length="4" string-pos="11">xyz</div>
This function does the same thing as tan:analyze-leaf-div-string-length()
, but
approaches the problem in a two-template cycle, instead of a loop
Used by function tan:analyze-string-length()
.
Relies upon ŧ analyze-string-length-pass-1
, ŧ analyze-string-length-pass-2
.
Option 1 (TAN-class-1-functions)
tan:div-to-div-transfer($items-with-div-content-to-be-transferred as item()*, $items-whose-divs-should-be-infused-with-new-content as item()*) as item()*
Two-parameter version of the fuller one, below
Used by function tan:div-to-div-transfer()
.
Relies upon tan:div-to-div-transfer()
.
Option 2 (TAN-class-1-functions)
tan:div-to-div-transfer($items-with-div-content-to-be-transferred as item()*, $items-whose-divs-should-be-infused-with-new-content as item()*, $break-at-regex as xs:string) as item()*
Input: (1) any set of divs with content to be transferred into the structure of (2) another set of divs; and (3) a snap marker.
Output: The div structure of (2), infused with the content of (1). The content is allocated proportionately, with preference given to punctuation, within a certain range, and then word breaks.
This function is useful for converting class-1 documents from one reference system to another. Normally the conversion is flawed, because two versions of the same work rarely synchronize, but this function provides a good estimate, or a starting point for manual correction.
The raw text will be tokenized based on the third parameter, so that, if you so wish, words, clauses, or sentences are not broken up.
Used by function tan:div-to-div-transfer()
.
Relies upon tan:infuse-divs()
, tan:text-join()
.
TAN-class-1-functions
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
Used by template ŧ 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-class-1-functions)
tan:imprint-adjustment-locator($adjustment-action-locators as element()*) as element()*
one-parameter version of the full one below
Used by template ŧ dependency-adjustments-pass-1
, ŧ dependency-adjustments-pass-2
, ŧ mark-reassigns
.
Used by function tan:imprint-adjustment-locator()
.
Relies upon tan:imprint-adjustment-locator()
.
Option 2 (TAN-class-1-functions)
tan:imprint-adjustment-locator($adjustment-action-locators as element()*, $errors-to-report as element()*) as element()*
Input: any locator from an adjustment action (ref, n, div-type, from-tok, through-tok); any errors to report
Output: the locator wrapped in its ancestral element and wrapping any errors
This function is used to mark class 1 files with a record of locators in class 2 adjustments
Used by template ŧ dependency-adjustments-pass-1
, ŧ dependency-adjustments-pass-2
, ŧ mark-reassigns
.
Used by function tan:imprint-adjustment-locator()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions
tan:infuse-divs($new-content-to-be-transferred as xs:string?, $items-whose-divs-should-be-infused-with-new-content as item()*, $break-at-regex as xs:string) as item()*
Input: a string; an XML fragment that has <div>
s
Output: the latter, infused with the former, infusing text proportionate to the
quantity of <div>
text being replaced
Used by function tan:div-to-div-transfer()
.
Relies upon tan:chop-string()
, ŧ analyze-string-length-pass-1
, ŧ analyze-string-length-pass-2
, ŧ infuse-tokenized-div-end-check
, ŧ infuse-tokenized-text
, ŧ infuse-tokenized-text-cleanup
.
Option 1 (TAN-class-1-functions)
tan:merge-divs($expanded-class-1-fragment as item()*) as item()*
See fuller version below
Used by function tan:merge-divs()
.
Relies upon tan:merge-divs()
.
Option 2 (TAN-class-1-functions)
tan:merge-divs($expanded-class-1-fragment as item()*, $itemize-leaf-divs as xs:boolean) as item()*
See fuller version below
Used by function tan:merge-divs()
.
Relies upon tan:merge-divs()
.
Option 3 (TAN-class-1-functions)
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 oftan: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
Used by function tan:merge-divs()
.
Relies upon ŧ merge-divs
.
Option 1 (TAN-class-1-functions)
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 ŧ tokenize-div
, ŧ core-expansion-terse
, ŧ text-join
.
Used by function tan:normalize-div-text()
, tan:analyze-leaf-div-text-length-loop()
.
Relies upon tan:normalize-div-text()
.
Option 2 (TAN-class-1-functions)
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)
Used by template ŧ tokenize-div
, ŧ core-expansion-terse
, ŧ text-join
.
Used by function tan:normalize-div-text()
, tan:analyze-leaf-div-text-length-loop()
.
Relies upon $special-end-div-chars-regex
, tan:normalize-div-text()
.
TAN-class-1-functions
tan:reset-hierarchy-loop($divs-to-process as element()*, $divs-to-integrate as element()*, $level-of-interest as xs:integer) as element()*
Input:<div>
s to process;<div>
s to merge
Output: any<div>
s in the first group with<div>
s in the second group that should be merged or passed to children will be passed through template mode reset-hierarchy; all others will be copied in place
We presume that only the first tan:ref is the one to match against
Used by template ŧ reset-hierarchy
.
Used by function tan:reset-hierarchy-loop()
.
Relies upon tan:reset-hierarchy-loop()
, ŧ reset-hierarchy
, ŧ strip-divs-to-reset
.
TAN-class-1-functions
tan:text-join($items as item()*) 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 template to class-1 files that have been expanded, because normalization will have already occurred.
Used by template ŧ text-join
, ŧ analyze-string-length-pass-1
, ŧ merge-divs
, ŧ class-1-expansion-verbose-pass-1
.
Used by function tan:div-to-div-transfer()
.
Relies upon ŧ text-join
.
TAN-class-1-functions
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
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon ŧ tokenize-div
.