Option 1 (diff-for-xslt2)
tan:diff($string1 as xs:string?, $string2 as xs:string?) as element()
two-parameter version of the full version below. The stagger and diminishment
factors are designed to get small as the length of the shortest string gets larger.
Used by function tan:diff
()
Relies upon tan:diff
.
Option 2 (diff-for-xslt2)
tan:diff($string1 as xs:string?, $string2 as xs:string?, $diminishment-base as xs:double, $diminishment-exp-adjustment as xs:double, $stagger-base-adjustment as xs:double, $stagger-exp-adjustment as xs:double) as element()
Input: any two strings.
Output: The differences between the two strings in the form of:
<diff>
<s1>
[text unique to string 1]</s1>
<s2>
[text unique to string 2]</s2>
<common>
[text shared by both strings]</common>
</diff>
The algorithm is designed for XSLT 2, in which too many nested loops prove fatal, and with
the assumption that the user could settle for a difference that finds a long common substring,
and not perhaps the longest common substring.
Used by function tan:diff
()
Relies upon tan:diff-loop
.
tan:diff-core($long-string as xs:string?, $short-string as xs:string?, $short-string-length as xs:double, $segment-length as xs:double, $segment-position as xs:double, $diminishment-base as xs:double, $diminishment-exp-adjustment as xs:double, $stagger-base-adjustment as xs:double, $stagger-exp-adjustment as xs:double, $loop-count as xs:integer, $line-count as xs:double) as element()*
Used by function tan:diff-loop
() tan:diff-core
()
Relies upon tan:escape
tan:diff-core
.
tan:diff-core-draft($long-string as xs:string?, $short-string as xs:string?, $short-string-length as xs:double?, $length-to-try as xs:double?, $position-to-try as xs:double?, $diminishment-factor as xs:double, $stagger-factor as xs:double) as element()*
Used by function tan:diff-core-draft
()
Relies upon tan:escape
tan:diff-core-draft
.
tan:diff-loop($string1 as xs:string?, $string2 as xs:string?, $diminishment-base as xs:double, $diminishment-exp-adjustment as xs:double, $stagger-base-adjustment as xs:double, $stagger-exp-adjustment as xs:double, $loop-count as xs:integer) as node()*
Used by function tan:diff
() tan:diff-loop
()
Relies upon tan:diff-core
tan:diff-loop
ŧ diff-rectify
.
tan:group-adjacent-elements($elements as element()*) as element()*
Input: any sequence of elements
Output: the same elements, but adjacent elements of the same name grouped together
Used by function tan:raw-diff
()
Does not rely upon global variables, keys, functions, or templates.
Option 1 (diff-for-xslt2)
tan:raw-diff($string-a as xs:string?, $string-b as xs:string?) as element()
2-param version of fuller one below
Used by template ŧ class-1-errors
Used by function tan:raw-diff
()
Relies upon tan:raw-diff
.
Option 2 (diff-for-xslt2)
tan:raw-diff($string-a as xs:string?, $string-b as xs:string?, $snap-to-word as xs:boolean) as element()
Input: any two strings; boolean indicating whether results should snap to nearest word
Output: an element with <a>
, <b>
, and <common>
children showing where strings a and b match and depart
This function was written after tan:diff, intended to be a cruder and faster way to check two strings against each other, suitable for validation without hanging due to nested recursion objections.
Used by template ŧ class-1-errors
Used by function tan:raw-diff
()
Relies upon tan:raw-diff-loop
tan:group-adjacent-elements
ŧ snap-to-word-pass-1
.
tan:raw-diff-loop($short-string as element()?, $long-string as element()?, $start-at-beginning as xs:boolean, $check-vertically-before-horizontally as xs:boolean, $loop-counter as xs:integer)
Used by function tan:raw-diff
() tan:raw-diff-loop
()
Relies upon tan:escape
tan:raw-diff-loop
.