Templates based on modes are frequently found across constituent files, so they are collated here separately, one entry per mode.
TAN-core-functions.xsl
<xsl:template priority='-5' match='document-node()' mode='#all' />
<xsl:template priority='-5' match='*' mode='#all' />
<xsl:template priority='-5' match='comment() | processing-instruction()' mode='#all' />
<xsl:template match='tan:error | tan:help | tan:warning | tan:fix | tan:fatal | tan:info' priority='-4' mode='#all' />
<xsl:template match='tei:teiHeader' mode='#all' priority='-4' />
<xsl:template match='tan:tail' mode='#all' priority='-4' />
We ignore tails in validation; retain otherwise
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-3-0-functions.xsl
<xsl:template match='tan:wit' mode='add-collation-pos-offset' />
Used by template ŧ clean-up-collation-pass-1
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-string-functions.xsl
<xsl:template match='tan:tok' mode='add-tok-pos' />
Used by function tan:tokenize-text()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='*:body | tan:div | tan:tok | tan:non-tok | tei:*' mode='analyze-string-length-pass-1' />
<xsl:template match='tan:a | tan:b | tan:common' mode='analyze-string-length-pass-1' />
To process tan:diff()
results
Used by function tan:infuse-divs()
, tan:analyze-string-length()
.
Relies upon tan:string-length()
, tan:text-join()
.
TAN-class-1-functions.xsl
<xsl:template match='*[@string-length or @s1-length or @s2-length]' mode='analyze-string-length-pass-2' />
Used by function tan:infuse-divs()
, tan:analyze-string-length()
.
Does not rely upon global variables, keys, functions, or templates.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
TAN-core-resolve-functions.xsl
<xsl:template match='tan:inclusion/*[tan:head]' mode='apply-inclusions-and-adjust-vocabulary' />
<xsl:template match='*[@include]' mode='apply-inclusions-and-adjust-vocabulary' />
<xsl:template match='tan:vocabulary/tan:TAN-voc' mode='apply-inclusions-and-adjust-vocabulary' />
We already know that<vocabulary>
targets a TAN-voc file, so we can skip the root element, and even the <head type="vocabulary">, and merely report back the<item>
s and<verb>
s
<xsl:template match='tan:head/tan:TAN-voc' mode='apply-inclusions-and-adjust-vocabulary' />
We retain those standard TAN vocabulary items only if they fetched something that matched a vocabulary filter
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Relies upon tan:copy-of-except()
, tan:element-vocabulary()
, tan:error()
, tan:help-extracted()
, ŧ prefix-attr-include
.
TAN-extra-functions.xsl
<xsl:template match='*' mode='batch-replace-advanced' />
<xsl:template match='@*' mode='batch-replace-advanced' />
<xsl:template match='text()' mode='batch-replace-advanced' />
Used by function tan:batch-replace-advanced()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='text()' mode='build-grouping-key' />
<xsl:template match='*' mode='build-grouping-key' />
Used by function tan:group-elements-by-shared-node-values()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-search-functions.xsl
<xsl:template match='node()' mode='claims-morpheus claims-morpheus-desc build-morpheus-ana build-morpheus-lex' />
<xsl:template match='oac:Body' mode='build-morpheus-ana' />
<xsl:template match='entry' mode='build-morpheus-ana' />
<xsl:template match='dict' mode='build-morpheus-ana' />
<xsl:template match='infl' mode='build-morpheus-ana' />
<xsl:template match='pofs | case | gend | num | mood | tense | voice | comp' mode='build-morpheus-ana build-morpheus-lex' />
Used by template ŧ claims-morpheus
.
Used by function tan:search-results-to-claims()
.
Relies upon $TAN-feature-vocabulary
.
TAN-search-functions.xsl
<xsl:template match='node()' mode='claims-morpheus claims-morpheus-desc build-morpheus-ana build-morpheus-lex' />
<xsl:template match='pofs | case | gend | num | mood | tense | voice | comp' mode='build-morpheus-ana build-morpheus-lex' />
<xsl:template match='infl' mode='build-morpheus-lex' />
<xsl:template match='dict' mode='build-morpheus-lex' />
<xsl:template match='hdwd' mode='build-morpheus-lex' />
<xsl:template match='@xml:lang' mode='build-morpheus-lex' />
Used by template ŧ claims-morpheus
.
Used by function tan:search-results-to-claims()
.
Relies upon $TAN-feature-vocabulary
.
TAN-core-expand-functions.xsl
<xsl:template match='collection' mode='catalog-expansion-terse' />
<xsl:template match='doc' mode='catalog-expansion-terse' />
Used by function tan:expand-doc()
.
Relies upon $duplicate-ids
, tan:duplicate-items()
, tan:error()
.
TAN-core-functions.xsl
<xsl:template match='*[@from][text()]' mode='check-and-expand-ranges' />
<xsl:template match='tan:ref[@from][tan:n]' priority='1' mode='check-and-expand-ranges' />
Used by function tan:analyze-sequence()
.
Relies upon $separator-hierarchy
, tan:error()
, tan:expand-numerical-sequence()
, tan:sequence-error()
, tan:string-to-numerals()
.
TAN-A-functions.xsl
<xsl:template match='tan:vocabulary/tan:item' priority='2' mode='check-referred-doc' />
This template overrides the one in TAN-core-expand-functions.xsl
TAN-core-expand-functions.xsl
<xsl:template match='tan:inclusion/* | tan:vocabulary/tan:item' priority='1' mode='check-referred-doc' />
Ignore anything deeper than inclusion.
<xsl:template match='tan:algorithm | tan:TAN-T/tan:head/tan:source | tei:TEI/tan:head/tan:source' mode='check-referred-doc' />
This component of the template mode is to check elements that point to non-TAN files
<xsl:template match=' tan:inclusion | tan:vocabulary | tan:TAN-A/tan:head/tan:source | tan:TAN-A-lm/tan:head/tan:source | tan:TAN-A-tok/tan:head/tan:source | tan:see-also | tan:morphology | tan:redivision | tan:model | tan:successor | tan:predecessor | tan:annotation' mode='check-referred-doc' />
Look for errors in a TAN document referred to; should not be applied to non-TAN files
<xsl:template match='tan:IRI' priority='2' mode='check-referred-doc' />
<xsl:template match='*[@href]' mode='check-referred-doc' />
Used by template ŧ core-expansion-normal
, ŧ core-expansion-terse
.
Relies upon $TAN-namespace
, $TAN-vocabularies
, $doc-catalogs
, $doc-id
, $duplicate-head-iris
, $empty-doc
, $empty-element
, $inclusions-resolved
, $internet-available
, $sources-resolved
, $vocabularies-resolved
, tan:base-uri()
, tan:catalogs()
, tan:class-number()
, tan:dateTime-to-decimal()
, tan:distinct-items()
, tan:element-vocabulary()
, tan:error()
, tan:get-1st-doc()
, tan:get-doc-history()
, tan:is-valid-uri()
, tan:last-change-agent()
, tan:normalize-text()
, tan:resolve-doc()
, tan:shallow-copy()
, tan:tan-type()
, tan:uri-relative-to()
, tan:url-is-local()
.
TAN-search-functions.xsl
<xsl:template match='node()' mode='claims-morpheus claims-morpheus-desc build-morpheus-ana build-morpheus-lex' />
<xsl:template match='/*' mode='claims-morpheus' />
Used by template ŧ claims-morpheus
.
Used by function tan:search-results-to-claims()
.
Relies upon ŧ build-morpheus-ana
, ŧ build-morpheus-lex
.
TAN-search-functions.xsl
<xsl:template match='node()' mode='claims-morpheus claims-morpheus-desc build-morpheus-ana build-morpheus-lex' />
Used by template ŧ claims-morpheus
.
Used by function tan:search-results-to-claims()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:head' mode='class-1-expansion-verbose-pass-1' />
<xsl:template match='tan:redivision' mode='class-1-expansion-verbose-pass-1' />
<xsl:template match='tan:model' mode='class-1-expansion-verbose-pass-1' />
<xsl:template match='tan:body' mode='class-1-expansion-verbose-pass-1' />
Anticipate the next pass, which will check redivisions against the current text, by analyzing the leaf div string length
Used by function tan:expand-doc()
.
Relies upon $doc-id
, $model-resolved
, $redivisions-resolved
, tan:analyze-leaf-div-string-length()
, tan:copy-of-except()
, tan:diff()
, tan:error()
, tan:expand-doc()
, tan:get-1st-doc()
, tan:merge-expanded-docs()
, tan:resolve-doc()
, tan:text-join()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:head' mode='class-1-expansion-verbose-pass-2' />
<xsl:template match='tan:redivision/tan:diff' mode='class-1-expansion-verbose-pass-2' />
The goal here is first to punctuate the diff elements with empty <div string-pos="">
anchors and then to rebuild the diff fragments within newly built <div>
s
<xsl:template match='tan:redivision/tan:diff/tan:b' mode='class-1-expansion-verbose-pass-2' />
if there's a<b>
without a comparion<a>
then copy it without variables;<b>
's with companion<a>
s get processed with the<a>
<xsl:template match='tan:redivision/tan:diff/tan:common | tan:redivision/tan:diff/tan:a' mode='class-1-expansion-verbose-pass-2' />
<xsl:template match='tan:model' mode='class-1-expansion-verbose-pass-2' />
<xsl:template match='tan:model/tan:body' mode='class-1-expansion-verbose-pass-2' />
<xsl:template match='tan:TAN-T/tan:body' mode='class-1-expansion-verbose-pass-2' />
<xsl:template match='tan:div' mode='class-1-expansion-verbose-pass-2' />
Used by function tan:expand-doc()
.
Relies upon <div>
, tan:analyze-numbers-in-string()
, tan:error()
, tan:help()
, tan:shallow-copy()
, tan:string-to-numerals()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:body' mode='class-1-expansion-verbose-pass-3' />
<xsl:template match='tan:div[not(tan:div)]' mode='class-1-expansion-verbose-pass-3' />
Used by function tan:expand-doc()
.
Relies upon tan:error()
, tan:xml-to-string()
.
TAN-class-2-functions.xsl
<xsl:template match='tan:div-ref' mode='core-expansion-normal class-2-expansion-normal' />
Used by function tan:expand-doc()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-A-lm-functions.xsl
<xsl:template match='tan:body' mode='class-2-expansion-terse' />
TAN-class-2-functions.xsl
<xsl:template match='tan:skip/tan:div-type | tan:skip/tan:n | tan:rename/tan:n | tan:passage | tan:from-tok | tan:through-tok | tan:rename | tan:reassign' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
<xsl:template match='tan:equate' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
equate locators should be more forgiving than other adjustment locators: you do not
want every value of @n
to match each source, only one combination
<xsl:template match='tan:to/tan:ref | tan:new/tan:ref' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
these refs do not assume the ref exists in the target sources
<xsl:template match='tan:ref' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
<xsl:template match='tan:pos' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
Tokens are identified by a combination of rgx/val plus pos. Because the latter is the only constant, we monitor identified tokens through tan:pos, not tan:rgx or tan:val
<xsl:template match='tan:chars' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
Used by function tan:expand-doc()
.
Relies upon tan:duplicate-items()
, tan:error()
, tan:node-before()
, tan:ordinal()
.
TAN-class-2-functions.xsl
<xsl:template match='tan:skip/tan:div-type | tan:skip/tan:n | tan:rename/tan:n | tan:passage | tan:from-tok | tan:through-tok | tan:rename | tan:reassign' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
<xsl:template match='tan:equate' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
equate locators should be more forgiving than other adjustment locators: you do not
want every value of @n
to match each source, only one combination
<xsl:template match='tan:to/tan:ref | tan:new/tan:ref' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
these refs do not assume the ref exists in the target sources
<xsl:template match='tan:ref' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
<xsl:template match='tan:pos' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
Tokens are identified by a combination of rgx/val plus pos. Because the latter is the only constant, we monitor identified tokens through tan:pos, not tan:rgx or tan:val
<xsl:template match='tan:chars' mode='class-2-expansion-terse class-2-expansion-terse-for-validation' />
Used by function tan:expand-doc()
.
Relies upon tan:duplicate-items()
, tan:error()
, tan:node-before()
, tan:ordinal()
.
TAN-class-2-functions.xsl
<xsl:template match='tan:source' mode='class-2-expansion-verbose' />
Used by function tan:expand-doc()
.
Relies upon tan:error()
, tan:get-1st-doc()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:div' mode='clean-reset-divs-1' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon ŧ clean-reset-divs-2
.
TAN-class-1-functions.xsl
<xsl:template match='tan:div[tan:ref/@reset]' mode='reset-hierarchy clean-reset-divs-2' />
<xsl:template match='tan:ref' mode='clean-reset-divs-2' />
Used by template ŧ clean-reset-divs-1
.
Used by function tan:expand-doc()
, tan:reset-hierarchy-loop()
, tan:reset-hierarchy()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-3-0-functions.xsl
<xsl:template match='tan:x | tan:witness' mode='clean-up-collation-pass-1' />
<xsl:template match='tan:previous-collation | tan:diagnostics' mode='clean-up-collation-pass-1' />
<xsl:template match='*[tan:u]' mode='clean-up-collation-pass-1' />
Used by function tan:collate()
.
Relies upon tan:collate()
, ŧ add-collation-pos-offset
.
TAN-core-3-0-functions.xsl
<xsl:template match='*[tan:u]' mode='clean-up-collation-pass-2' />
At the end of cleanup, there may be adjacent <c>
s, which should be consolidated
Used by function tan:collate()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-3-0-functions.xsl
<xsl:template match='tan:witness' mode='collation-to-strings' />
Used by function tan:collation-to-strings()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='copy-of-except' />
Used by function tan:copy-of-except()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='squelch' priority='-5' mode='core-expansion-ad-hoc-pre-pass' />
Used by function tan:expand-doc()
.
Does not rely upon global variables, keys, functions, or templates.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
TAN-A-functions.xsl
<xsl:template match='tan:subject/tan:div | tan:object/tan:div' priority='1' mode='core-expansion-normal' />
This template prevents a <div>
within a claim being treated as if part of a class 1
file.
TAN-voc-functions.xsl
<xsl:template match='tan:body' mode='core-expansion-normal' />
<xsl:template match='tan:name' mode='core-expansion-normal' />
TAN-class-1-functions.xsl
<xsl:template match='tan:body | tan:div' mode='core-expansion-normal' />
TAN-class-2-functions.xsl
<xsl:template match='tan:div-ref' mode='core-expansion-normal class-2-expansion-normal' />
TAN-core-expand-functions.xsl
<xsl:template match='/*' mode='core-expansion-normal dependency-expansion-normal' />
<xsl:template match='tan:master-location' mode='core-expansion-normal' />
<xsl:template match='tan:see-also | tan:model | tan:redivision | tan:successor | tan:predecessor | tan:algorithm | tan:source[tan:location] | tan:annotation' mode='core-expansion-normal' />
<xsl:template match='text()[matches(., '\S')]' mode='core-expansion-normal' />
Text should have already been subject to tan:normalize-text()
in the terse phase.
This routine checks for other anomalies.
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Relies upon $orig-self
, $regex-characters-not-permitted
, tan:copy-of-except()
, tan:error()
, tan:get-1st-doc()
, tan:get-doc-history()
, tan:group-elements-by-shared-node-values()
, tan:normalize-name()
, tan:xml-to-string()
, ŧ check-referred-doc
.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
TAN-A-functions.xsl
<xsl:template match='/' mode='core-expansion-terse' />
<xsl:template match='tan:claim/tan:work | tan:object/tan:work | tan:subject/tan:work' mode='core-expansion-terse' />
This template targets <work>
elements in the body, not the head
Such a step would ordinarily have been taken in the previous expansion pass, on attributes, but it didn't have the extra vocabulary.
<xsl:template match='tan:group[tan:work]' mode='core-expansion-terse' />
<xsl:template match='tan:body' mode='core-expansion-terse' />
<xsl:template match='tan:claim' mode='core-expansion-terse' />
subjects and verbs are the only two elements of a claim that are inheritable, since they are the only ones expected to be the basis for grouping claims
<xsl:template match='tan:subject | tan:object' mode='core-expansion-terse' />
TAN-A-lm-functions.xsl
<xsl:template match='tan:adjustments' mode='core-expansion-terse' />
<xsl:template match='tan:body' mode='core-expansion-terse' />
<xsl:template match='tan:tok' mode='core-expansion-terse' />
<xsl:template match='tan:m' mode='core-expansion-terse' />
This step breaks down the<m>
into constituent<f>
s with@n
indicating position, and the values normalized (lowercase)
TAN-mor-functions.xsl
<xsl:template match='*[@which]/tan:id' priority='1' mode='core-expansion-terse' />
This template overrules the default, because TAN-mor files must cite all features that are allowed, and many times the name is conveniently also the perfect id.
TAN-voc-functions.xsl
<xsl:template match='tan:body' mode='core-expansion-terse' />
<xsl:template match='*[@affects-element]/tan:affects-element' mode='core-expansion-terse' />
<xsl:template match='tan:item | tan:verb' mode='core-expansion-terse' />
TAN-class-1-functions.xsl
<xsl:template match='tan:redivision | tan:TAN-T/tan:head/tan:companion-version | tei:TEI/tan:head/tan:companion-version' mode='core-expansion-terse' />
<xsl:template match='tan:model' mode='core-expansion-terse' />
<xsl:template match='tan:TAN-T | tei:TEI' mode='core-expansion-terse dependency-adjustments-pass-1' />
Homogenize tei:TEI to tan:TAN-T
<xsl:template match='tei:body' mode='core-expansion-terse dependency-adjustments-pass-1' />
<xsl:template match='tei:text' mode='core-expansion-terse dependency-adjustments-pass-1' />
Makes sure tei:body rises rootward one level, as is customary for <body>
in TAN and
HTML
<xsl:template match='tan:div | tei:div' mode='core-expansion-terse' />
streamlined expansion of <div>
s; applied to dependencies of class-2 files only
when there are no more adjustment items to process
<xsl:template match='tei:lb | tei:pb | tei:cb' mode='core-expansion-terse dependency-adjustments-pass-1 normalize-tei-space' />
TAN-class-2-functions.xsl
<xsl:template match='tan:source | tan:morphology[not(@attr)]' mode='core-expansion-terse' />
<xsl:template match='tan:rename' mode='core-expansion-terse' />
<xsl:template match='tan:rename/tan:by' mode='core-expansion-terse' />
<xsl:template match='tan:tok[not(tan:from)] | tan:tok/tan:from | tan:tok/tan:to | tan:from-tok | tan:through-tok' mode='core-expansion-terse' />
<xsl:template match=' tan:adjustments/tan:skip/tan:div-type | tan:adjustments/tan:*/tan:ref | tan:adjustments/tan:*/tan:n | tan:passage/tan:ref' mode='core-expansion-terse' />
TAN-class-3-functions.xsl
<xsl:template match='tan:TAN-mor/tan:body' mode='dependency-adjustments-pass-1 core-expansion-terse' />
<xsl:template match='tan:category ' mode='dependency-adjustments-pass-1 core-expansion-terse' />
<xsl:template match='tan:feature/tan:type' mode='dependency-adjustments-pass-1 core-expansion-terse' />
<xsl:template match='tan:feature/tan:code' mode='dependency-adjustments-pass-1 core-expansion-terse' />
TAN-core-expand-functions.xsl
<xsl:template match='/*' mode='core-expansion-terse' priority='-2' />
<xsl:template match='tan:head' mode='core-expansion-terse' />
<xsl:template match='tan:inclusion | tan:vocabulary' mode='core-expansion-terse' />
<xsl:template match='*[@which]/tan:id' mode='core-expansion-terse' />
<xsl:template match='tan:name' mode='core-expansion-terse' />
parameters below are populated only in TAN-voc files
<xsl:template match='tan:IRI' mode='core-expansion-terse' />
The next param is specific to TAN-voc files
<xsl:template match='tan:token-definition' mode='core-expansion-terse' />
<xsl:template match='tan:vocabulary-key' mode='core-expansion-terse' />
<xsl:template match='tan:file-resp' mode='core-expansion-terse' />
<xsl:template match='tan:to-do' mode='core-expansion-terse' />
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Relies upon $TAN-elements-that-take-the-attribute-which
, $TAN-id-namespace
, $TAN-namespace
, $TAN-version
, $TAN-version-is-under-development
, $TAN-vocabularies
, $TAN-vocabulary-files
, $all-selector
, $datatypes-that-require-unit-specification
, $doc-id
, $doc-id-namespace
, $doc-is-error-test
, $doc-uri
, $duplicate-head-iris
, $empty-element
, $model-resolved
, $names-of-elements-that-describe-text-bearers
, $names-of-elements-that-describe-textual-entities
, $objects-target-what-elements-names
, $official-urn-namespaces
, $previous-TAN-versions
, $redivisions-resolved
, $separator-hierarchy
, $subjects-target-what-elements-names
, $token-definition-default
, tan:analyze-numbers-in-string()
, tan:analyze-sequence()
, tan:attribute-vocabulary()
, tan:data-type-check()
, tan:distinct-items()
, tan:doc-id-namespace()
, tan:duplicate-items()
, tan:element-vocabulary()
, tan:error()
, tan:get-1st-doc()
, tan:group-elements-by-shared-node-values()
, tan:help-extracted()
, tan:last-change-agent()
, tan:must-refer-to-external-tan-file()
, tan:normalize-div-text()
, tan:normalize-name()
, tan:resolve-doc()
, tan:shallow-copy()
, tan:target-element-names()
, tan:vocabulary()
, ŧ check-referred-doc
, ŧ selective-shallow-skip
.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
TAN-class-1-functions.xsl
<xsl:template match='tei:div[not(tei:div)]/tei:*' priority='1' mode='resolve-numerals core-expansion-terse-attributes' />
TAN-core-expand-functions.xsl
<xsl:template match='comment()' mode='core-expansion-terse-attributes' />
<xsl:template match='/*' priority='1' mode='core-expansion-terse-attributes' />
<xsl:template match='tei:teiHeader' mode='core-expansion-terse-attributes' />
<xsl:template match='tan:head[tan:adjustments]' priority='1' mode='core-expansion-terse-attributes' />
<xsl:template match='tan:head/tan:vocabulary[tan:location] | tan:head/tan:tan-vocabulary' priority='1' mode='core-expansion-terse-attributes' />
<xsl:template match='*[@*]' mode='core-expansion-terse-attributes' />
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Relies upon $names-of-attributes-that-take-idrefs
, tan:duplicate-items()
, tan:error()
, tan:help()
, tan:help-extracted()
, tan:normalize-name()
, tan:target-element-names()
, tan:vocabulary()
, ŧ core-expansion-terse-attributes-to-elements
, ŧ remove-inclusions
.
TAN-core-expand-functions.xsl
<xsl:template match='@*' mode='core-expansion-terse-attributes-to-elements' />
<xsl:template match='@xml:id | @id' mode='core-expansion-terse-attributes-to-elements' />
<xsl:template match='@from | @to | tan:*/@when | @ed-when | @accessed-when' mode='core-expansion-terse-attributes-to-elements' />
We do not expand into elements any attribute that is a single value
<xsl:template match='@pattern | @matches-m | @matches-tok | @rgx' mode='core-expansion-terse-attributes-to-elements' />
<xsl:template match='@href' mode='core-expansion-terse-attributes-to-elements' />
no need to convert to element
<xsl:template match='@ref | @pos | @chars | tan:equate/@n | tan:skip/@n | tan:rename/@n' mode='core-expansion-terse-attributes-to-elements' />
gets converted to one element per atomic value
<xsl:template match='*[@val]/@chars' priority='1' mode='core-expansion-terse-attributes-to-elements' />
<xsl:template match='*[@ref]/@new' mode='core-expansion-terse-attributes-to-elements' />
gets converted to one element per atomic value
<xsl:template match='*[@n]/@new' mode='core-expansion-terse-attributes-to-elements' />
gets converted to one element per atomic value
<xsl:template match='@val | @by' mode='core-expansion-terse-attributes-to-elements' />
<xsl:template match='@code | @div-type | @affects-element | @affects-attribute | @item-type | @in-lang' mode='core-expansion-terse-attributes-to-elements' />
Used by template ŧ core-expansion-terse-attributes
.
Relies upon $all-ids
, $doc-uri
, $duplicate-ids
, $internet-available
, $names-of-attributes-that-are-case-indifferent
, $names-of-attributes-that-may-take-multiple-space-delimited-values
, $now
, tan:analyze-sequence()
, tan:chop-string()
, tan:dateTime-to-decimal()
, tan:duplicate-values()
, tan:error()
, tan:expand-numerical-sequence()
, tan:help-extracted()
, tan:path()
, tan:sequence-error()
, tan:stamp-q-id()
, tan:uri-relative-to()
, tan:url-is-local()
.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
TAN-core-expand-functions.xsl
<xsl:template match='/*' mode='core-expansion-verbose' />
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Relies upon tan:catalogs()
, tan:collection()
, tan:error()
, tan:expand-doc()
, tan:resolve-doc()
.
TAN-core-functions.xsl
<xsl:template match='/collection' mode='cut-faulty-hrefs' />
<xsl:template match='doc' mode='cut-faulty-hrefs' />
Used by function tan:catalogs()
.
Relies upon tan:error()
.
TAN-A-lm-functions.xsl
<xsl:template match='tan:tan-vocabulary/tan:item[tan:affects-element = 'feature']/tan:id' mode='dependency-adjustments-pass-1' />
ids for features are not allowed to be case-sensitive
<xsl:template match='tan:vocabulary-key/tan:feature[@xml:id][tan:IRI]' mode='dependency-adjustments-pass-1' />
We copy @xml:id
for an internally defined vocab key feature, to make it easier to
match vocab items to feature codes
TAN-class-1-functions.xsl
<xsl:template match='tan:TAN-T | tei:TEI' mode='core-expansion-terse dependency-adjustments-pass-1' />
Homogenize tei:TEI to tan:TAN-T
<xsl:template match='tan:head' mode='dependency-adjustments-pass-1' />
<xsl:template match='tei:body' mode='core-expansion-terse dependency-adjustments-pass-1' />
<xsl:template match='tei:text' mode='core-expansion-terse dependency-adjustments-pass-1' />
Makes sure tei:body rises rootward one level, as is customary for <body>
in TAN and
HTML
<xsl:template match='*:body/text() | *:div[*:div]/text()' mode='dependency-adjustments-pass-1' />
<xsl:template match='tan:div | tei:div' mode='dependency-adjustments-pass-1' />
This template applies<skip>
,<rename>
, and<equate>
in class 2<adjustments>
upon a dependency class 1 file, and expands<n>
and<ref>
Errors in<adjustments>
are embedded to report back to the dependent class 2 file. In those cases, the error is associated not with the specific instruction but its locator, i.e., the element +@q
version of the the expanded forms of@div-type
,@n
,@ref.
.
<xsl:template match='tei:lb | tei:pb | tei:cb' mode='core-expansion-terse dependency-adjustments-pass-1 normalize-tei-space' />
<xsl:template match='tan:div/comment()' mode='dependency-adjustments-pass-1' />
TAN-class-3-functions.xsl
<xsl:template match='tan:TAN-mor/tan:body' mode='dependency-adjustments-pass-1 core-expansion-terse' />
<xsl:template match='tan:category ' mode='dependency-adjustments-pass-1 core-expansion-terse' />
<xsl:template match='tan:feature/tan:type' mode='dependency-adjustments-pass-1 core-expansion-terse' />
<xsl:template match='tan:feature/tan:code' mode='dependency-adjustments-pass-1 core-expansion-terse' />
Used by function tan:expand-doc()
.
Relies upon $TAN-version
, $TAN-version-is-under-development
, $all-selector
, $doc-id
, $empty-element
, $previous-TAN-versions
, $separator-hierarchy
, $special-end-div-chars-regex
, tan:analyze-sequence()
, tan:duplicate-items()
, tan:error()
, tan:imprint-adjustment-locator()
, tan:last-change-agent()
, tan:path()
, tan:shallow-copy()
, ŧ core-expansion-terse-attributes
, ŧ selective-shallow-skip
.
TAN-class-1-functions.xsl
<xsl:template match='/' mode='dependency-adjustments-pass-2' />
<xsl:template match='tan:head' mode='dependency-adjustments-pass-2' />
<xsl:template match='tan:div' mode='dependency-adjustments-pass-2' />
We do not break the template out according to leaf divs and non-leaf divs because in
the course of renaming, mixed <div>
s might have been created
Used by function tan:expand-doc()
.
Relies upon $all-selector
, $token-definition-default
, tan:duplicate-items()
, tan:error()
, tan:imprint-adjustment-locator()
, tan:shallow-copy()
, tan:tokenize-text()
, ŧ expand-reassigns
, ŧ mark-reassigns
, ŧ unmark-tokens
.
TAN-class-1-functions.xsl
<xsl:template match='tan:body' mode='dependency-expansion-normal' />
<xsl:template match='tan:div' mode='dependency-expansion-normal' />
TAN-core-expand-functions.xsl
<xsl:template match='/*' mode='core-expansion-normal dependency-expansion-normal' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon tan:tokenize-text()
.
TAN-class-1-functions.xsl
<xsl:template match='/*' mode='dependency-expansion-verbose' />
<xsl:template match='tan:div' mode='dependency-expansion-verbose' />
<xsl:template match='tan:tok | tan:non-tok' mode='dependency-expansion-verbose' />
<xsl:template match='text()' mode='dependency-expansion-verbose' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon tan:tokenize-text()
.
TAN-core-string-functions.xsl
<xsl:template match='tan:diff' mode='diff-to-collation' />
<xsl:template match='tan:common' mode='diff-to-collation' />
<xsl:template match='tan:a' mode='diff-to-collation' />
<xsl:template match='tan:b' mode='diff-to-collation' />
Used by function tan:collate()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='element-fingerprint' />
<xsl:template match='comment() | processing-instruction()' mode='element-fingerprint' />
<xsl:template match='text()' mode='element-fingerprint' />
Used by function tan:element-fingerprint()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-errors.xsl
<xsl:template match='*' mode='element-to-error' />
This template turns any simple element (e.g.,<report>
,<assert>
,<comment>
,<change>
) into an error report
Used by template ŧ tan-a-lm-expansion-terse
.
Relies upon $errors
.
TAN-A-lm-functions.xsl
<xsl:template match='@m-matches' mode='evaluate-conditions' />
<xsl:template match='@m-has-how-many-features' mode='evaluate-conditions' />
<xsl:template match='@m-has-features' mode='evaluate-conditions' />
<xsl:template match='@tok-matches' mode='evaluate-conditions' />
TAN-core-functions.xsl
<xsl:template match='*' mode='evaluate-conditions' />
<xsl:template match='@*' mode='evaluate-conditions' />
Used by function tan:all-conditions-hold-evaluation-loop()
.
Relies upon tan:expand-numerical-sequence()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:passage' mode='expand-reassigns' />
<xsl:template match='tan:from-tok' mode='expand-reassigns' />
<xsl:template match='tan:through-tok' mode='expand-reassigns' />
Used by template ŧ dependency-adjustments-pass-2
.
Relies upon tan:error()
, tan:expand-pos-or-chars()
.
TAN-core-resolve-functions.xsl
<xsl:template match='/*' mode='expand-standard-tan-voc' />
<xsl:template match='*[@href]' mode='resolve-href expand-standard-tan-voc' />
Used by variable $TAN-vocabularies
.
Relies upon tan:base-uri()
, tan:shallow-copy()
.
TAN-core-resolve-functions.xsl
<xsl:template match='/*' mode='first-stamp-shallow-skip first-stamp-shallow-copy resolve-href' />
<xsl:template match='processing-instruction()' mode='resolve-href first-stamp-shallow-copy' />
<xsl:template match='*' mode='first-stamp-shallow-copy' />
<xsl:template match='tan:head/tan:vocabulary[@which]' mode='first-stamp-shallow-copy' />
<xsl:template match='tan:name' mode='first-stamp-shallow-copy' />
<xsl:template match='tan:alias' mode='first-stamp-shallow-copy' />
Used by template ŧ first-stamp-shallow-skip
, ŧ resolve-critical-dependencies-loop
.
Used by function tan:resolve-doc-loop()
, tan:resolve-href()
, tan:get-1st-doc()
, tan:tokenize-text()
.
Relies upon $TAN-vocabularies
, tan:base-uri()
, tan:error()
, tan:is-valid-uri()
, tan:normalize-name()
.
TAN-core-resolve-functions.xsl
<xsl:template match='@* | text() | comment() | processing-instruction()' mode='first-stamp-shallow-skip' />
<xsl:template match='*' mode='first-stamp-shallow-skip' />
<xsl:template match='tan:head' mode='first-stamp-shallow-skip' />
<xsl:template match='/*' mode='first-stamp-shallow-skip first-stamp-shallow-copy resolve-href' />
Used by template ŧ resolve-critical-dependencies-loop
.
Used by function tan:resolve-doc-loop()
.
Relies upon tan:normalize-name()
, tan:shallow-copy()
, ŧ first-stamp-shallow-copy
.
TAN-core-functions.xsl
<xsl:template match='*' mode='fragment-to-text' />
<xsl:template match='@*' mode='fragment-to-text' />
<xsl:template match='comment()' mode='fragment-to-text' />
<xsl:template match='processing-instruction()' mode='fragment-to-text' />
<xsl:template match='text()' mode='fragment-to-text' />
Used by function tan:xml-to-string()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='* | text() | comment() | processing-instruction() | document-node()' mode='get-doc-history' />
<xsl:template match='tan:tan-vocabulary | tan:inclusion/tei:* | tan:inclusion/tan:TAN-T | tan:inclusion/tan:TAN-A | tan:inclusion/tan:TAN-A-tok | tan:inclusion/tan:TAN-A-lm | tan:inclusion/tan:TAN-mor | tan:inclusion/tan:TAN-voc' mode='get-doc-history' />
<xsl:template match='*[@when or @ed-when or @accessed-when or @claim-when]' mode='get-doc-history' />
Used by function tan:get-doc-history()
.
Relies upon tan:dateTime-to-decimal()
.
TAN-search-functions.xsl
<xsl:template match='text() | processing-instruction() | comment()' mode='get-IRI-name' />
<xsl:template match='document-node() | *' mode='get-IRI-name' />
<xsl:template match='xhtml:a | a[@href]' mode='get-IRI-name' priority='2' />
viaf results yield html in no namespace
<xsl:message>
xhtml:a found</xsl:message> <xsl:message select="tan:shallow-copy(
.)"/>
<xsl:template match='mods:mods' mode='get-IRI-name' priority='2' />
<xsl:template match='ul[@class = 'mw-search-results']/li' mode='get-IRI-name' />
wikipedia hits
Used by function tan:search-results-to-IRI-name-pattern()
.
Does not rely upon global variables, keys, functions, or templates.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-extra-functions.xsl
<xsl:template match='*' mode='imitate-validation' />
new stuff
Used by variable $orig-self-validated
.
Relies upon $errors-to-squelch
, $self-expanded
, tan:error-report()
, tan:get-via-q-ref()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:ref | tan:n | tan:div-type | tan:from-tok | tan:through-tok' mode='imprint-adjustment-action' />
This template is used to leave the imprint of a class-2 adjustment action within a class-1 file.
It imprints both the ref, n, or div-type, wrapped in a copy of its parent (with attributes)
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon $errors
.
TAN-A-functions.xsl
<xsl:template match='tan:body' mode='imprint-vocabulary' priority='1' />
TAN-voc-functions.xsl
<xsl:template match='tan:body | tan:group | tan:item' mode='imprint-vocabulary' priority='1' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='indent-items' />
<xsl:template match='text()' mode='indent-items' />
Used by function tan:copy-indentation()
.
Relies upon tan:fill()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:mold' mode='infuse-tokenized-div-end-check' />
<xsl:template match='*:div[not(*:div)]' mode='infuse-tokenized-div-end-check' />
Used by function tan:infuse-divs()
.
Relies upon $zwj
.
TAN-class-1-functions.xsl
<xsl:template match='*:div[not(*:div)]' mode='infuse-tokenized-text' />
Used by function tan:infuse-divs()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='*:div' mode='infuse-tokenized-text-cleanup' />
<xsl:template match='tan:k' mode='infuse-tokenized-text-cleanup' />
Used by function tan:infuse-divs()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='insert-content' />
Used by function tan:insert-as-last-child()
, tan:insert-as-first-child()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-extra-functions.xsl
<xsl:template match='tan:n' mode='integers-to-sequence' />
Used by function tan:integers-to-sequence()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-A-lm-extra-functions.xsl
<xsl:template match='node()' mode='itemize-lms' />
<xsl:template match='tan:ana' mode='itemize-lms' />
<xsl:template match='tan:l' mode='itemize-lms' />
Used by function tan:merge-anas()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:reassign | tan:equate | tan:skip | tan:rename' mode='mark-dependencies-for-validation mark-dependencies-for-validation-skip-divs' />
<xsl:template match='/*' mode='mark-dependencies-for-validation' />
<xsl:template match='tan:TAN-T/tan:body' mode='mark-dependencies-for-validation' />
<xsl:template match='tan:div' mode='mark-dependencies-for-validation' />
Used by template ŧ mark-dependencies-pass-2-for-validation
, ŧ mark-dependencies-for-validation
, ŧ mark-dependencies-pass-1
.
Relies upon tan:shallow-copy()
, tan:tokenize-text()
, tan:xml-to-string()
, ŧ mark-dependencies-for-validation-skip-divs
.
TAN-class-1-functions.xsl
<xsl:template priority='-1' match='* | text()' mode='mark-dependencies-for-validation-skip-divs' />
<xsl:template match='tan:reassign | tan:equate | tan:skip | tan:rename' mode='mark-dependencies-for-validation mark-dependencies-for-validation-skip-divs' />
<xsl:template match='tan:div' mode='mark-dependencies-for-validation-skip-divs' />
Used by template ŧ mark-dependencies-pass-2-for-validation
, ŧ mark-dependencies-for-validation
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='/' priority='1' mode='mark-dependencies-pass-1' />
<xsl:template match='tan:body' mode='mark-dependencies-pass-1' />
<xsl:template match='tan:div' mode='mark-dependencies-pass-1' />
<xsl:template match='tan:div[not(tan:div)]/text()' mode='mark-dependencies-pass-1' />
TAN-class-3-functions.xsl
<xsl:template match='tan:TAN-mor' mode='mark-dependencies-pass-1 mark-dependencies-pass-2' />
Used by function tan:expand-doc()
.
Relies upon $token-definition-default
, tan:shallow-copy()
, tan:tokenize-text()
, tan:vocabulary()
, tan:xml-to-string()
, ŧ mark-dependencies-for-validation
.
TAN-class-1-functions.xsl
<xsl:template match='*[tan:hold]' mode='mark-dependencies-pass-2' />
<xsl:template match='tan:hold' mode='mark-dependencies-pass-2' />
<xsl:template match='tan:tok' mode='mark-dependencies-pass-2' />
TAN-class-3-functions.xsl
<xsl:template match='tan:TAN-mor' mode='mark-dependencies-pass-1 mark-dependencies-pass-2' />
Used by function tan:expand-doc()
.
Relies upon tan:chop-string()
, tan:expand-pos-or-chars()
, tan:sequence-error()
.
TAN-class-1-functions.xsl
<xsl:template match='/' priority='1' mode='mark-dependencies-pass-2-for-validation' />
<xsl:template match='tan:div/tan:n | tan:div/tan:ref | tan:non-tok | tan:div/tan:tok[not(*)]' mode='mark-dependencies-pass-2-for-validation' />
<xsl:template match='tan:body' mode='mark-dependencies-pass-2-for-validation' />
<xsl:template match='tan:div' mode='mark-dependencies-pass-2-for-validation' />
This is quite close to the one for tan:body, but it's a shallow skip, and token references are a bit trickier.
Used by function tan:expand-doc()
.
Relies upon tan:error()
, tan:expand-numerical-sequence()
, tan:sequence-error()
, ŧ mark-dependencies-for-validation-skip-divs
.
TAN-class-1-functions.xsl
<xsl:template match='tan:tok | tan:non-tok' mode='mark-reassigns' />
Used by template ŧ dependency-adjustments-pass-2
.
Relies upon tan:copy-of-except()
, tan:imprint-adjustment-locator()
, tan:shallow-copy()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:chars' mode='mark-tok-chars' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon tan:expand-pos-or-chars()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:pos' mode='mark-tok-pos' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon tan:error()
, tan:expand-pos-or-chars()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:body' mode='merge-divs' />
<xsl:template match='tan:group' mode='merge-divs' />
<xsl:template match='tan:div[not(tan:div)]' mode='merge-divs' />
Special feature to itemize leaf divs, to differentiate them in a merge from <div>
s of
other versions
Used by function tan:merge-divs()
.
Relies upon $separator-hierarchy
, tan:group-divs()
, tan:text-join()
, ŧ strip-duplicate-children-by-attribute-value
.
TAN-class-1-functions.xsl
<xsl:template match='tan:div' mode='merge-tan-doc-leaf-divs' />
<xsl:template match='tan:ref' mode='merge-tan-docs merge-tan-doc-leaf-divs' />
<xsl:template match='tan:_weight | tan:_rel-pos | tan:_n-pos | tan:_n-integer | tan:non-numbered' mode='merge-tan-docs merge-tan-doc-leaf-divs stamp-with-src-attr' />
Used by template ŧ merge-tan-docs
.
Relies upon $separator-hierarchy
.
TAN-class-1-functions.xsl
<xsl:template match='/*' mode='merge-tan-docs' />
A merged TAN-T file is a collation of multipleTAN-T(
EI) files, with each head preserved intact, and the single body consisting of a hierarchy of divs grouped by a common reference scheme, dictated by@n.
. This function has assumed the following principles, most important first: - merged output need not have everything needed to reconstruct the original sources, but the data must permit enough differentiation among sources to facilitate a variety of later uses, and therefore different configurations: - merged versions should retain their relative order - in a merge,<div>
s should be sorted by numerical order, or by relative order, taking the group of divs as a whole - merges on the leaf div level should not lack any version, including versions that span or bridge other leaf divs - if a merge results in multiple copies, or parts, of a div, the div should be tagged with appropriate metadata
The above list will be better understood in light of specific challenges in class 1 merges, discussed below.
Some challenges in merging TAN-T files, discussed point by point:
Challenge: A div with a particular ref/n might be split, with other divs in-between Resolution: all split divs will be grouped together, because the whole point of a merge is, well, to merge. Suppose you had to merge a leaf div from version A with a split leaf div from version B. If you did not fully merge B you would need to move A into one B split or the other, or put one copy of A in one split and another in the other. The situation would get even more complicated for a version C with non-leaf divs that would need to be merged. On the other hand, the grouping does not mean consolidation. The two, three, or more parts of a split div will be preserved as sibling elements within a merge. To assist in later processing, such split divs will be given@part
and@part-count
and appropriate integers (to be able to express something like "part 1 of 3"). In addition, each split div element will have the same value for@q
, to facilitate referencing.
Challenge: A particular version might have a div where numerical@ns
do not follow their original sequence (remember, a TAN-T file should follow the sequence of the text within the scriptum, not the reference system) Resolution: A merge necessarily has to rearrange divs. As a general rule, the order of divs should be determined by adhering to the numerical value of@ns.
.
Challenge: Many@ns
are not numbers, and a non-numerical div may appear in rather different places in different versions. Resolution: The position of a merged div with a non-numerical@n
should be determined in accordance with principles outlined above regarding the order of divs. Suppose you have version one with div@ns
of (epigraph), (1), (2); version two with (1), (2), (epigraph). The merge should result, for better or worse, with the divs ordered: (1), (epigraph), (2). Similarly, a version one with divs (title), (1), (2), ... (59), (60) and a version two with divs (title), (1), should result in the order of version one, and not something like (1), (2), ... (15), (title), (16), ... (59), (60). The position of non-numerical divs should be determined by nearby numerical div context, specifically the closest previous numerical@n
value, then the distance from it (i.e., calculate the number of intervening divs with non-numerical@n
values that intervene).
Challenge: Some non-numerical @n
's appear in different orders in different
versions. Resolution: An example of the challenge would be the Old Testament / Tanakh. Modern
editions have an order of books that diverges from what is in the Septuagint, and a merge of
those two versions, according to the principles outlined above, would result in an
idiosyncractic order followed by no version. If the user wishes such divs to follow a particular
order, it is up to a later process to re-sort the output.
Challenge: Some@ns
might have multiple values, with complex overlap patterns Resolution: In a merge, when the algorithm encounters multiple values of@n
, any numerical values are retained, excluding any non-numerical values, and the numerals are treated as requiring distribution. That is, if@n
points to multiple numerical references, copies of the div are to distributed to the atomic numerical values of@n.
. If no non-numerical values are found, the values are treated as aliases, and invite merging, greedily. Numerical example: four divs with@n
values of (The_Cow, 1), (The_Cow, 2), (1), (2). The non-numerical values are ignored for their numerical counterparts, resulting in two merge groups, one for 1, another for 2. Non-numerical example: three divs with@n
values of (head), (head, title), (title). Greedy overlap of the aliases results in a single group. Mixed example: three divs with@n
values of (head), (head, title, 1), (title). Because the middle term has a numerical value, the non-numerical values are ignored, resulting in three merge groups: head, 1, and title. This group too would be merged: Numerical example with ranges: four divs with@n
values of (1), (2), (3), (1-3). The last@n
value, a complex/spanning range, requires distribution. Three merge groups are created. The three copies of the fourth div are each imprinted with@copy
(value 1, 2, or 3) and@copy-count
(value 3). Each copy retains intact its@q
id, and its content. If an application using a merge requires the content to be reallocated proportionately, it will need to perform that operation upon the merged output. (There are many methods of proportional reallocation, and some of them require inspection of other versions that are in the merge, so there is little point in implementing in this merge algorithm a complex process that many users will not find useful or representative of their assumptions.) The position of merged divs follow the principles detailed earlier. Those with numerical references retain their position relative to their@n
value. Those with only non-numerical references will attract a position computed by their position relative to the closest preceding div with a numerical value for@n.
.
<xsl:template match='tan:head' mode='merge-tan-docs' />
<xsl:template match='tan:body | tan:div' mode='merge-tan-docs' />
<xsl:template match='tan:ref' mode='merge-tan-docs merge-tan-doc-leaf-divs' />
<xsl:template match='tan:_weight | tan:_rel-pos | tan:_n-pos | tan:_n-integer | tan:non-numbered' mode='merge-tan-docs merge-tan-doc-leaf-divs stamp-with-src-attr' />
TAN-core-functions.xsl
<xsl:template match='document-node()' mode='merge-tan-docs' />
Used by function tan:merge-expanded-docs()
.
Relies upon $separator-hierarchy
, tan:distinct-items()
, tan:group-divs-by-ref()
, ŧ merge-tan-doc-leaf-divs
, ŧ prep-div-refs-pass-1
.
TAN-class-1-functions.xsl
<xsl:template match='tei:lb | tei:pb | tei:cb' mode='core-expansion-terse dependency-adjustments-pass-1 normalize-tei-space' />
Used by function tan:expand-doc()
.
Relies upon tan:error()
, ŧ selective-shallow-skip
.
TAN-extra-functions.xsl
<xsl:template match='text()' mode='normalize-xml-fragment-space' />
Used by function tan:normalize-xml-element-space()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='pluck' />
<xsl:template match='text()' mode='pluck' />
<xsl:template match='comment() | processing-instruction()' mode='pluck' />
Used by function tan:pluck()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-resolve-functions.xsl
<xsl:template match='*[@include]' mode='prefix-attr-include' />
Used by template ŧ apply-inclusions-and-adjust-vocabulary
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:div' mode='prep-div-refs-pass-1' />
<xsl:template match='tan:ref' mode='prep-div-refs-pass-1' />
Used by template ŧ merge-tan-docs
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:div[not(tan:ref[tan:_n-integer])]' mode='prep-div-refs-pass-2' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-extra-functions.xsl
<xsl:template match='* | processing-instruction() | comment()' mode='prepend-line-break' />
Useful for breaking up XML content that is not indented
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:group' mode='process-appended-div' />
<xsl:template match='tan:div' mode='process-appended-div' />
Used by template ŧ reset-hierarchy
.
Relies upon $separator-hierarchy
, ŧ strip-divs-to-reset
.
TAN-class-1-functions.xsl
<xsl:template match='tan:div' mode='process-merged-div' />
Used by template ŧ reset-hierarchy
.
Relies upon ŧ strip-divs-to-reset
.
TAN-extra-functions.xsl
<xsl:template match='*' mode='remove-duplicate-siblings' />
Used by function tan:remove-duplicate-siblings()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:div[not(tan:div)]' mode='remove-first-token' />
Used by function tan:expand-doc()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-expand-functions.xsl
<xsl:template match='tan:inclusion' mode='remove-inclusions' />
Used by template ŧ core-expansion-terse-attributes
.
Used by function tan:attribute-vocabulary()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='/' mode='reset-hierarchy' />
<xsl:template match='tan:head' mode='reset-hierarchy' />
<xsl:template match='tan:div[tan:ref/@reset]' mode='reset-hierarchy clean-reset-divs-2' />
<xsl:template match='tan:body | tan:div' mode='reset-hierarchy' />
divs to reset fall into three categories: 1. those that should be merged with the current div, because there's an exact match on the ref 2. those that should be passed on to children because of a match on the n in the next level children 3. those that should be appended as last children Any attempts to merge leaf divs with non-leaf divs should trigger an error message, to be imprinted in the adjustment action marker that caused the reset.
Used by function tan:expand-doc()
, tan:reset-hierarchy-loop()
, tan:reset-hierarchy()
.
Relies upon tan:reset-hierarchy-loop()
, ŧ process-appended-div
, ŧ process-merged-div
.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-resolve-functions.xsl
<xsl:template match='tan:inclusion[tan:location] | tan:vocabulary[tan:location]' mode='resolve-critical-dependencies-loop' />
<xsl:template match='tan:inclusion/tan:IRI | tan:vocabulary/tan:IRI' mode='resolve-critical-dependencies-loop' />
<xsl:template match='tan:inclusion/tan:location[@href] | tan:vocabulary/tan:location[@href]' mode='resolve-critical-dependencies-loop' />
<xsl:template match='tan:vocabulary-key' mode='resolve-critical-dependencies-loop' />
We send all vocabulary filters through the official TAN vocabularies; these will
come out as <TAN-voc>
elements, which will get fixed in the next step
Used by function tan:resolve-doc-loop()
.
Relies upon $TAN-version
, $TAN-vocabularies
, $doc-id
, tan:base-uri()
, tan:error()
, tan:get-1st-doc()
, tan:is-valid-uri()
, tan:resolve-doc-loop()
, tan:shallow-copy()
, ŧ first-stamp-shallow-skip
.
TAN-core-resolve-functions.xsl
<xsl:template match='/*' mode='first-stamp-shallow-skip first-stamp-shallow-copy resolve-href' />
<xsl:template match='processing-instruction()' mode='resolve-href first-stamp-shallow-copy' />
<xsl:template match='*[@href]' mode='resolve-href expand-standard-tan-voc' />
Used by template ŧ first-stamp-shallow-skip
, ŧ resolve-critical-dependencies-loop
.
Used by function tan:resolve-doc-loop()
, tan:resolve-href()
, tan:get-1st-doc()
, tan:tokenize-text()
.
Relies upon tan:base-uri()
, tan:shallow-copy()
.
catalog.tan-functions.xsl
<xsl:template match='collection' priority='2' mode='get-undefined-idrefs resolve-critical-dependencies apply-inclusions-and-adjust-vocabulary resolve-numerals core-expansion-terse core-expansion-normal core-expansion-verbose core-expansion-terse-attributes' />
TAN-class-1-functions.xsl
<xsl:template match='tei:div[not(tei:div)]/tei:*' priority='1' mode='resolve-numerals core-expansion-terse-attributes' />
TAN-core-resolve-functions.xsl
<xsl:template match='/*' priority='1' mode='resolve-numerals' />
<xsl:template match='*[@include] | tan:inclusion' priority='1' mode='resolve-numerals' />
<xsl:template match='*:div[@n]' mode='resolve-numerals' />
<xsl:template match='tan:ref | tan:n' mode='resolve-numerals' priority='1' />
This part of resolve numerals handles class 2 references that have already been expanded from attributes to elements.
Because class-2@ref
and@n
are never tethered to a div type, we cannot enforce the constraints in the source class-1 file's<n-alias>
Used by template ŧ dependency-adjustments-pass-1
.
Used by function tan:expand-doc()
, tan:resolve-doc-loop()
.
Relies upon tan:error()
, tan:string-to-numerals()
.
TAN-extra-functions.xsl
<xsl:template match='node() | @*' mode='revise-hrefs' />
<xsl:template match='processing-instruction()' priority='1' mode='revise-hrefs' />
<xsl:template match='@href' mode='revise-hrefs' />
<xsl:template match='html:script/@src' mode='revise-hrefs' />
Used by function tan:revise-hrefs()
.
Relies upon tan:uri-relative-to()
.
TAN-class-1-functions.xsl
<xsl:template match='* | comment() | processing-instruction()' mode='selective-shallow-skip' />
Used by template ŧ core-expansion-terse
dependency-adjustments-pass-1 normalize-tei-space.
Does not rely upon global variables, keys, functions, or templates.
TAN-extra-functions.xsl
<xsl:template match='*' mode='sequence-to-tree' />
Used by function tan:sequence-to-tree()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='node() | document-node()' mode='shallow-copy' />
Used by function tan:shallow-copy()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-string-functions.xsl
<xsl:template match='tan:common' mode='snap-to-word-pass-1' />
Used by function tan:diff()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='stamp-q-id' />
Used by function tan:stamp-q-id()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:_weight | tan:_rel-pos | tan:_n-pos | tan:_n-integer | tan:non-numbered' mode='merge-tan-docs merge-tan-doc-leaf-divs stamp-with-src-attr' />
Used by template ŧ merge-tan-docs
.
Used by function tan:merge-expanded-docs()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='tan:tok' mode='string-to-numerals' />
Used by function tan:analyze-numbers-in-string()
.
Relies upon $n-type
, $n-type-pattern
, $separator-hierarchy-minor
, tan:aaa-to-int()
, tan:letter-to-number()
, tan:rom-to-int()
.
TAN-core-functions.xsl
<xsl:template match='*' mode='strip-all-attributes-except' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:head | text()' mode='strip-dependencies-to-markers' />
<xsl:template match='/*' mode='strip-dependencies-to-markers' />
<xsl:template match='*' mode='strip-dependencies-to-markers' />
<xsl:template match='tan:skip | tan:rename | tan:equate | tan:reassign | tan:ref | tan:pos | tan:chars | tan:tok[@val]' mode='strip-dependencies-to-markers' />
Used by function tan:expand-doc()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:rename | tan:reassign' mode='strip-divs-to-reset' />
<xsl:template match='tan:ref[@reset]' mode='strip-divs-to-reset' />
<xsl:template match='tan:div[tan:ref[@reset]]' mode='strip-divs-to-reset' />
Used by template ŧ process-merged-div
, ŧ process-appended-div
.
Used by function tan:reset-hierarchy-loop()
.
Relies upon tan:error()
.
TAN-core-functions.xsl
<xsl:template match='*' mode='strip-duplicate-children-by-attribute-value' />
Used by template ŧ merge-divs
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='* | text()' priority='-3' mode='strip-for-validation' />
<xsl:template match='*[tan:error | tan:help | tan:warning | tan:fix | tan:fatal | tan:info]' priority='-2' mode='strip-for-validation' />
<xsl:template match='tan:error | tan:help | tan:warning | tan:fix | tan:fatal | tan:info' priority='-1' mode='strip-for-validation' />
<xsl:template match='/*' priority='-1' mode='strip-for-validation' />
Used by function tan:expand-doc()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='strip-specific-attributes' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-extra-functions.xsl
<xsl:template match='text()' mode='strip-text' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-A-lm-functions.xsl
<xsl:template match='tan:m' mode='tan-a-lm-expansion-terse' />
<xsl:template match='tan:f[text()]' mode='tan-a-lm-expansion-terse' />
Used by function tan:expand-doc()
.
Relies upon tan:all-conditions-hold()
, tan:error()
, tan:shallow-copy()
, tan:vocabulary()
, tan:xml-to-string()
, ŧ element-to-error
.
TAN-class-1-functions.xsl
<xsl:template match='* | text()' mode='text-join' />
<xsl:template match='/tan:*/tan:expanded[1]' mode='text-join' />
<xsl:template match='*:div[not(*:div)]' mode='text-join' />
Used by function tan:text-join()
.
Relies upon tan:normalize-div-text()
, tan:text-join()
.
TAN-extra-functions.xsl
<xsl:template match='* | comment() | processing-instruction()' mode='text-only' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Does not rely upon global variables, keys, functions, or templates.
TAN-extra-functions.xsl
<xsl:template match='tan:word[1] | tan:word[last()]' mode='title-case' />
Used by function tan:title-case()
.
Relies upon tan:initial-upper-case()
.
TAN-class-1-functions.xsl
<xsl:template match='tan:div[not((tan:div, tan:tok))]/text()' mode='tokenize-div' />
Used by function tan:tokenize-div()
.
Relies upon $special-end-div-chars-regex
, tan:normalize-div-text()
, tan:tokenize-text()
.
TAN-extra-functions.xsl
<xsl:template match='*' mode='tree-to-sequence' />
Used by function tan:tree-to-sequence()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='text()' mode='trim-long-text' />
Used by function tan:trim-long-text()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-3-0-functions.xsl
<xsl:template match='tan:a | tan:b | tan:common' mode='trim-or-add-text' />
Used by function tan:adjust-diff()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-class-1-functions.xsl
<xsl:template match='tan:tok/* | tan:non-tok/*' mode='unmark-tokens' />
Used by template ŧ dependency-adjustments-pass-2
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='node() | @*' mode='uri-relative-to' />
<xsl:template match='@href' mode='uri-relative-to' />
No variables, keys, functions, or named templates depend upon this xsl:template.
Relies upon tan:base-uri()
, tan:uri-relative-to()
.
TAN-core-functions.xsl
<xsl:template match='*' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
vocab trawling shallow skips by default
<xsl:template match='text() | comment() | processing-instruction()' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template priority='1' match='tan:vocabulary | tan:tan-vocabulary' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template priority='1' match='tan:vocabulary/tan:IRI | tan:vocabulary/tan:name | tan:vocabulary/tan:location | tan:tan-vocabulary/tan:IRI | tan:tan-vocabulary/tan:name | tan:tan-vocabulary/tan:location' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template match='*[tan:IRI] | tan:token-definition | tan:item[tan:token-definition] | tan:claim' mode='vocabulary-all-vals' />
Used by function tan:vocabulary()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
vocab trawling shallow skips by default
<xsl:template match='text() | comment() | processing-instruction()' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template priority='1' match='tan:vocabulary | tan:tan-vocabulary' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template priority='1' match='tan:vocabulary/tan:IRI | tan:vocabulary/tan:name | tan:vocabulary/tan:location | tan:tan-vocabulary/tan:IRI | tan:tan-vocabulary/tan:name | tan:tan-vocabulary/tan:location' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template match='*[tan:id][tan:IRI] | tan:claim[tan:id]' mode='vocabulary-by-id' />
Used by function tan:vocabulary()
.
Does not rely upon global variables, keys, functions, or templates.
TAN-core-functions.xsl
<xsl:template match='*' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
vocab trawling shallow skips by default
<xsl:template match='text() | comment() | processing-instruction()' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template priority='1' match='tan:vocabulary | tan:tan-vocabulary' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template priority='1' match='tan:vocabulary/tan:IRI | tan:vocabulary/tan:name | tan:vocabulary/tan:location | tan:tan-vocabulary/tan:IRI | tan:tan-vocabulary/tan:name | tan:tan-vocabulary/tan:location' mode='vocabulary-all-vals vocabulary-by-id vocabulary-by-name' />
<xsl:template match='*[tan:IRI][tan:name] | tan:token-definition | tan:item[tan:token-definition]' mode='vocabulary-by-name' />
Used by function tan:vocabulary()
.
Does not rely upon global variables, keys, functions, or templates.