Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CreNum
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Elan Littératures et Arts Numériques
CreNum
Commits
f1b10627
Commit
f1b10627
authored
3 months ago
by
Anne GARCIA-FERNANDEZ
Browse files
Options
Downloads
Patches
Plain Diff
Improve index - rdg and rdgGrp taken into account
parent
4a75d0d1
No related branches found
Branches containing commit
No related tags found
1 merge request
!99
Merge Search functionnality to Master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
data/xslt/tei2search_jsonIndex.xsl
+66
-43
66 additions, 43 deletions
data/xslt/tei2search_jsonIndex.xsl
with
66 additions
and
43 deletions
data/xslt/tei2search_jsonIndex.xsl
+
66
−
43
View file @
f1b10627
...
@@ -16,10 +16,14 @@
...
@@ -16,10 +16,14 @@
xmlns=
"http://www.w3.org/1999/xhtml"
exclude-result-prefixes=
"xs tei"
version=
"2.0"
>
xmlns=
"http://www.w3.org/1999/xhtml"
exclude-result-prefixes=
"xs tei"
version=
"2.0"
>
<xsl:output
method=
"text"
indent=
"yes"
encoding=
"UTF-8"
omit-xml-declaration=
"yes"
/>
<xsl:output
method=
"text"
indent=
"yes"
encoding=
"UTF-8"
omit-xml-declaration=
"yes"
/>
<xsl:variable
name=
"br"
>
<xsl:variable
name=
"br
_pretty_print
"
>
<xsl:text>
<xsl:text>
</xsl:text>
</xsl:text>
</xsl:variable>
</xsl:variable>
<xsl:variable
name=
"br_minify"
>
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:variable
name=
"br"
select=
"$br_pretty_print"
/>
<xsl:strip-space
elements=
"tei:choice"
/>
<xsl:strip-space
elements=
"tei:choice"
/>
<xsl:strip-space
elements=
"tei:l"
/>
<xsl:strip-space
elements=
"tei:l"
/>
...
@@ -30,7 +34,7 @@
...
@@ -30,7 +34,7 @@
<xsl:template
match=
"/"
>
<xsl:template
match=
"/"
>
<xsl:variable
name=
"tei"
select=
"current()"
/>
<xsl:variable
name=
"tei"
select=
"current()"
/>
<xsl:text>
{
</xsl:text>
<xsl:text>
[
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<xsl:value-of
select=
"$br"
/>
<xsl:for-each
select=
"tei:TEI/tei:text/tei:body//tei:div[@type = 'book']"
>
<xsl:for-each
select=
"tei:TEI/tei:text/tei:body//tei:div[@type = 'book']"
>
<xsl:sort
select=
"@n"
data-type=
"number"
/>
<xsl:sort
select=
"@n"
data-type=
"number"
/>
...
@@ -39,7 +43,7 @@
...
@@ -39,7 +43,7 @@
<xsl:for-each
select=
".//tei:l"
>
<xsl:for-each
select=
".//tei:l"
>
<xsl:variable
name=
"l"
select=
"."
as=
"node()"
/>
<xsl:variable
name=
"l"
select=
"."
as=
"node()"
/>
<xsl:text>
[
</xsl:text>
<xsl:text>
{
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<xsl:value-of
select=
"$br"
/>
<!-- Numero du livre -->
<!-- Numero du livre -->
...
@@ -55,20 +59,11 @@
...
@@ -55,20 +59,11 @@
<xsl:text>
",
</xsl:text>
<xsl:text>
",
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<xsl:value-of
select=
"$br"
/>
<!-- Lemme -->
<xsl:variable
name=
"lem"
>
<xsl:apply-templates
mode=
"lem"
/>
</xsl:variable>
<xsl:text>
"lem": "
</xsl:text>
<xsl:value-of
select=
"normalize-space($lem)"
/>
<xsl:text>
",
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<!-- Témoins -->
<!-- Témoins -->
<xsl:for-each-group
select=
".//@wit/tokenize(., ' ')"
group-by=
"."
>
<xsl:for-each-group
select=
".//
*/
@wit/tokenize(., ' ')"
group-by=
"."
>
<xsl:variable
name=
"witness "
select=
"."
/>
<xsl:variable
name=
"witness "
select=
"."
/>
<xsl:if
<xsl:if
test=
"exists($l//
tei:rdg[
@wit
=
$witness and not(@type = 'irrelevant')])"
>
test=
"exists($l//
*[contains(
@wit
,
$witness
)
and not(@type = 'irrelevant')])"
>
<xsl:variable
name=
"lesson"
>
<xsl:variable
name=
"lesson"
>
<xsl:apply-templates
select=
"$l"
mode=
"witness"
>
<xsl:apply-templates
select=
"$l"
mode=
"witness"
>
<xsl:with-param
name=
"wit"
select=
"$witness"
tunnel=
"yes"
/>
<xsl:with-param
name=
"wit"
select=
"$witness"
tunnel=
"yes"
/>
...
@@ -83,31 +78,41 @@
...
@@ -83,31 +78,41 @@
<xsl:text>
",
</xsl:text>
<xsl:text>
",
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<xsl:value-of
select=
"$br"
/>
</xsl:if>
</xsl:if>
<!--
<xsl:if test="$l_num = '411'">
<xsl:message>411 - <xsl:value-of select="$witness"/></xsl:message>
</xsl:if>
<xsl:if test="$l_num = '412'">
<xsl:message terminate="yes"> Debug - Stops for specifiied $l_num</xsl:message>
</xsl:if>-->
</xsl:for-each-group>
</xsl:for-each-group>
<xsl:text>
]
</xsl:text>
<!-- Lemme -->
<xsl:variable
name=
"lem"
>
<xsl:apply-templates
mode=
"lem"
/>
</xsl:variable>
<xsl:text>
"lem": "
</xsl:text>
<xsl:value-of
select=
"normalize-space($lem)"
/>
<xsl:text>
"
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<!-- Closing Json -->
<xsl:text>
}
</xsl:text>
<xsl:if
test=
"position() < last()"
>
<xsl:if
test=
"position() < last()"
>
<xsl:text>
,
</xsl:text>
<xsl:text>
,
</xsl:text>
</xsl:if>
</xsl:if>
<xsl:value-of
select=
"$br"
/>
<xsl:value-of
select=
"$br"
/>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:text>
}
</xsl:text>
<xsl:text>
]
</xsl:text>
<xsl:value-of
select=
"$br"
/>
<xsl:value-of
select=
"$br"
/>
</xsl:template>
</xsl:template>
<!-- Templates for lemma version -->
<!-- Template for both lemma and witnesses versions -->
<xsl:template
match=
"tei:app"
mode=
"lem"
>
<xsl:apply-templates
select=
"tei:lem"
mode=
"lem"
/>
</xsl:template>
<xsl:template
match=
"tei:lem"
mode=
"lem"
>
<xsl:apply-templates
mode=
"#current"
/>
</xsl:template>
<xsl:template
match=
"
<xsl:template
match=
"
tei:reg | tei:persName | tei:placeName | tei:orgName |
tei:reg | tei:persName | tei:placeName | tei:orgName |
tei:geogName | tei:pc | tei:date | tei:said | tei:subst | tei:add |
tei:geogName | tei:pc | tei:date | tei:said | tei:subst | tei:add |
tei:num | tei:foreign | tei:hi | tei:quote | tei:title | tei:unclear |
tei:num | tei:foreign | tei:hi | tei:quote | tei:title | tei:unclear |
tei:gap"
mode=
"lem witness"
>
tei:gap"
mode=
"lem witness"
>
<xsl:apply-templates
mode=
"#current"
/>
<xsl:apply-templates
mode=
"#current"
/>
</xsl:template>
</xsl:template>
...
@@ -116,42 +121,60 @@
...
@@ -116,42 +121,60 @@
<xsl:apply-templates
select=
"tei:reg"
mode=
"#current"
/>
<xsl:apply-templates
select=
"tei:reg"
mode=
"#current"
/>
</xsl:template>
</xsl:template>
<xsl:template
match=
"tei:metamark | tei:orig | tei:del | tei:note"
mode=
"lem witness"
/>
<xsl:template
match=
"tei:del"
mode=
"lem witness"
>
<!-- del à vérifier : que renvoit-on comme résultat de recherche ? -->
<!-- del à vérifier : que renvoit-on comme résultat de recherche ?
Pour le moment, <s></s> car mais barré... c'est déjà présent donc peut être renvoyé par la recherche...
mais on pourrait aussi l'enlever en considérant la forme absents du témoin...
cf. vers numéro 411 pour un exemple (rdg wit="#Aix419") -->
<xsl:if
test=
"not(. = '')"
>
<xsl:text
disable-output-escaping=
"yes"
>
<
s>
</xsl:text>
<xsl:apply-templates
mode=
"#current"
/>
<xsl:text
disable-output-escaping=
"yes"
>
<
/s>
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template
match=
"tei:metamark | tei:orig | tei:note"
mode=
"lem witness"
/>
<!-- Templates for lemma version -->
<xsl:template
match=
"tei:app"
mode=
"lem"
>
<xsl:apply-templates
select=
"tei:lem"
mode=
"lem"
/>
</xsl:template>
<xsl:template
match=
"tei:lem"
mode=
"lem"
>
<xsl:apply-templates
mode=
"#current"
/>
</xsl:template>
<!-- Templates for a specific witness version -->
<!-- Templates for a specific witness version -->
<xsl:template
match=
"tei:app"
mode=
"witness"
>
<xsl:template
match=
"tei:app"
mode=
"witness"
>
<xsl:apply-templates
mode=
"#current"
/>
<xsl:apply-templates
mode=
"#current"
/>
</xsl:template>
</xsl:template>
<xsl:template
match=
"tei:l"
mode=
"witness"
>
<xsl:template
match=
"tei:l"
mode=
"witness"
>
<xsl:param
name=
"wit"
tunnel=
"yes"
/>
<xsl:param
name=
"wit"
tunnel=
"yes"
/>
<xsl:apply-templates
mode=
"witness"
/>
<xsl:apply-templates
mode=
"witness"
/>
</xsl:template>
</xsl:template>
<xsl:template
match=
"tei:lem"
mode=
"witness"
>
<xsl:template
match=
"tei:lem
| tei:rdg
"
mode=
"witness"
>
<xsl:param
name=
"wit"
tunnel=
"yes"
/>
<xsl:param
name=
"wit"
tunnel=
"yes"
/>
<xsl:message>
<xsl:if
test=
"
lem
<xsl:value-of
select=
"$wit"
/>
contains(@wit, $wit)
</xsl:message>
or (
<xsl:if
test=
"not(following-sibling::tei:rdg[@wit = $wit])"
>
not(following::*[contains(@wit, $wit)])
and not(preceding::*[contains(@wit, $wit)])
)"
>
<!-- todo: and not(.//contains(@wit, $wit)) -->
<xsl:apply-templates
mode=
"witness"
/>
<xsl:apply-templates
mode=
"witness"
/>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:template>
<xsl:template
match=
"tei:rdg"
mode=
"witness"
>
<xsl:template
match=
"tei:rdg
Grp
"
mode=
"witness"
>
<xsl:param
name=
"wit"
tunnel=
"yes"
/>
<xsl:param
name=
"wit"
tunnel=
"yes"
/>
<xsl:message>
<xsl:apply-templates
mode=
"witness"
/>
rdg
<xsl:value-of
select=
"$wit"
/>
</xsl:message>
<xsl:if
test=
"@wit = $wit"
>
<xsl:apply-templates
mode=
"witness"
/>
</xsl:if>
</xsl:template>
</xsl:template>
<xsl:template
match=
"tei:rdgGrp[@type
=
'irrelevant']"
mode=
"witness"
/>
<xsl:template
match=
"tei:rdgGrp[@type
=
'irrelevant']"
mode=
"witness"
/>
<!-- DEBUG SECTION - Templates used to show warnings if unexpected elements or attributes -->
<!-- DEBUG SECTION - Templates used to show warnings if unexpected elements or attributes -->
<xsl:template
match=
"tei:*"
mode=
"#all"
>
<xsl:template
match=
"tei:*"
mode=
"#all"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment