diff-for-xslt2 global variables, keys, and functions summarized

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 .

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 .