TAN-core-3-0-functions
tan:adjust-diff($diff-output as element()*) as element()*
Input: any output<diff>
s fromtan:diff()
Output: the output adjusted, with<a>
and<b>
s adjusted if there are more optimal placements
Used by function tan:collate()
, tan:giant-diff()
, tan:adjust-diff()
.
Relies upon tan:adjust-diff()
, tan:common-end-string()
, tan:common-start-string()
, ŧ trim-or-add-text
.
TAN-core-3-0-functions
tan:collation-to-strings($tan-collate-output as element()?) as element()*
Input: any output from tan:collate (version for XSLT 3.0)
Output: a sequence of <witness id="">[ORIGINAL STRING]</witness>
This function was written to reverse, and therefore test the integrity of, the
output of tan:collate()
No variables, keys, functions, or named templates depend upon this xsl:function.
Relies upon ŧ collation-to-strings
.
TAN-core-3-0-functions
tan:common-end-string($strings as xs:string*) as xs:string?
See full function below
Used by function tan:adjust-diff()
, tan:diff-outer-loop()
.
Relies upon tan:common-start-or-end-string()
.
Option 1 (TAN-core-3-0-functions)
tan:common-start-or-end-string($strings as xs:string*, $find-common-start as xs:boolean) as xs:string?
See full function below
Used by function tan:common-start-string()
, tan:common-end-string()
, tan:common-start-or-end-string()
.
Relies upon tan:common-start-or-end-string()
.
Option 2 (TAN-core-3-0-functions)
tan:common-start-or-end-string($string-a as xs:string?, $string-b as xs:string?, $find-common-start as xs:boolean) as xs:string?
Input: two strings; a boolean
Output: the longest common start (param 2 is true) or end (param 2 is false) portion of the two strings.
Used by function tan:common-start-string()
, tan:common-end-string()
, tan:common-start-or-end-string()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-3-0-functions
tan:common-start-string($strings as xs:string*) as xs:string?
See full function below
Used by function tan:adjust-diff()
, tan:diff-outer-loop()
.
Relies upon tan:common-start-or-end-string()
.
TAN-core-3-0-functions
tan:diff-cache($string-a as xs:string?, $string-b as xs:string?, $snap-to-word as xs:boolean, $preprocess-long-strings as xs:boolean) as element()
This is a shadow function fortan:diff()
. It uses XSLT 3.0@cache
, so thattan:collate()
can avoid repeating diffs
Used by function tan:collate()
.
Relies upon tan:diff()
.
TAN-core-3-0-functions
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: a <collation>
with the data prepped for merging with other collations
This function was written to support the XSLT 3.0 version of tan:collate()
Used by function tan:collate()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-3-0-functions
tan:giant-diff($string-a as xs:string?, $string-b as xs:string?, $snap-to-word as xs:boolean, $string-a-segment-length as xs:integer, $string-b-segment-length as xs:integer) as element()
Input: same parameters as 3-ary tan:diff()
; two integers
Output: the same as tan:diff()
, but handled differently; the two integers specify
the segment lengths into which the first and second strings, respectively, should be
cut.
Used by function tan:giant-diff()
, tan:diff()
.
Relies upon $empty-element
, tan:adjust-diff()
, tan:diff()
, tan:ellipses()
, tan:giant-diff()
.
TAN-core-3-0-functions
tan:longest-ascending-subsequence($integer-sequence as item()*) as element()*
Input: a sequence of items. Each item is either an integer or a sequence of integers (via child elements)
Output: a sequence of elements. Each one has in its text node an integer greater than
the preceding element's text node. Each output element has a @pos
with an integer
identifying the position of the input item that has been chosen (to handle 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 adding a number to the sequence would require a jump, the sequence is created, but a copy of the pre-gapped sequence is memoized, in case it is later discovered that the pre-gapped sequence is better.
The input is a sequence of elements, not 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 in XSLT 3.0 as maps
are.
Used by function tan:collate-pair-of-sequences()
, tan:longest-ascending-subsequence()
.
Relies upon tan:longest-ascending-subsequence()
.