Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EUPT XML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
subugoe
EUPT
EUPT XML
Commits
736e1c08
Commit
736e1c08
authored
11 months ago
by
zeterberg
Browse files
Options
Downloads
Patches
Plain Diff
feat(commentaries): add new structure for commentaries
parent
2bb30f13
No related branches found
No related tags found
1 merge request
!26
Resolve "Move comments below unit lines"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scenarios/xslt/edxml2html/libs/html-facsimile.lib.xsl
+135
-67
135 additions, 67 deletions
scenarios/xslt/edxml2html/libs/html-facsimile.lib.xsl
with
135 additions
and
67 deletions
scenarios/xslt/edxml2html/libs/html-facsimile.lib.xsl
+
135
−
67
View file @
736e1c08
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:tei=
"http://www.tei-c.org/ns/1.0"
xmlns=
"http://www.w3.org/1999/xhtml"
exclude-result-prefixes=
"xs"
version=
"2.0"
xpath-default-namespace=
"http://sub.uni-goettingen.de/edxml#"
>
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:tei=
"http://www.tei-c.org/ns/1.0"
xmlns:functx=
"http://www.functx.com"
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:uuid=
"java:java.util.UUID"
exclude-result-prefixes=
"xs"
version=
"2.0"
xpath-default-namespace=
"http://sub.uni-goettingen.de/edxml#"
>
<xsl:function
name=
"functx:substring-before-if-contains"
as=
"xs:string?"
>
<xsl:param
name=
"arg"
as=
"xs:string?"
/>
<xsl:param
name=
"delim"
as=
"xs:string"
/>
<xsl:sequence
select=
"
if (contains($arg, $delim))
then
substring-before($arg, $delim)
else
$arg
"
/>
</xsl:function>
<xsl:template
match=
"facsimile"
>
<div
class=
"facsimile section"
<div
class=
"facsimile section"
id=
"{if(@xml:id) then (@xml:id) else ('facs_'||generate-id(.))}"
>
<xsl:apply-templates
/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template
match=
"surface"
>
<div
class=
"surface"
id=
"{if(@xml:id) then (@xml:id) else ('surf_'||generate-id(.))}"
>
<xsl:apply-templates
/>
<div
class=
"surface"
id=
"{if(@xml:id) then (@xml:id) else ('surf_'||generate-id(.))}"
>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template
match=
"column"
>
<xsl:variable
name=
"nr"
select=
"if(@n) then(@n) else(count(preceding::column)+1)"
/>
<xsl:variable
name=
"id"
select=
"if(@xml:id) then (@xml:id) else ('colu_'||generate-id(.))"
/>
<div
class=
"column"
id=
"{$id}"
data-n=
"{$nr}"
>
<xsl:apply-templates
/>
<xsl:variable
name=
"nr"
select=
"
if (@n) then
(@n)
else
(count(preceding::column) + 1)"
/>
<xsl:variable
name=
"id"
select=
"
if (@xml:id) then
(@xml:id)
else
('colu_' || generate-id(.))"
/>
<div
class=
"column"
id=
"{$id}"
data-n=
"{$nr}"
>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template
match=
"line[not(@n)]|surface//note"
>
<div
class=
"note"
id=
"{if(@xml:id) then (@xml:id) else ('line_'||generate-id(.))}"
>
<xsl:apply-templates
/>
<!--<xsl:template match="line[not(@n)] | surface//note">
<div class="note" id="{if(@xml:id) then (@xml:id) else ('line_'||generate-id(.))}">
<xsl:apply-templates/>
</div>
</xsl:template>
</xsl:template>
-->
<xsl:template
match=
"line[@n]"
>
<xsl:variable
name=
"nr"
select=
"@n"
/>
<xsl:variable
name=
"auto-nr"
select=
"if($nr) then($nr) else(count(preceding::line)+1)"
/>
<xsl:variable
name=
"id"
select=
"if(@xml:id) then (@xml:id) else ('line_'||generate-id(.))"
/>
<div
class=
"line"
id=
"{$id}"
>
<a
href=
"#{$id}"
class=
"line-anchor"
>
<span>
<xsl:choose>
<xsl:when
test=
"@n"
>
<xsl:attribute
name=
"class"
>
line-nr explicit
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name=
"class"
>
line-nr calculated
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of
select=
"$auto-nr"
/>
<xsl:variable
name=
"auto-nr"
select=
"
if ($nr) then
($nr)
else
(count(preceding::line) + 1)"
/>
<xsl:variable
name=
"id"
select=
"
if (@xml:id) then
(@xml:id)
else
('line_' || generate-id(.))"
/>
<xsl:variable
name=
"targetIds"
select=
".//@xml:id"
/>
<xsl:variable
name=
"allFollowingNotes"
select=
"./ancestor::surface/following-sibling::notes/note"
/>
<xsl:variable
name=
"correspondingNotes"
>
<xsl:for-each
select=
"$allFollowingNotes"
>
<xsl:if
test=
"substring-after(functx:substring-before-if-contains(@target, ' '), '#') = $targetIds"
>
<xsl:copy-of
select=
"."
/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<div
class=
"line-container"
>
<div
class=
"line"
id=
"{$id}"
>
<a
href=
"#{$id}"
class=
"line-anchor"
>
<span>
<xsl:choose>
<xsl:when
test=
"@n"
>
<xsl:attribute
name=
"class"
>
line-nr explicit
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name=
"class"
>
line-nr calculated
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of
select=
"$auto-nr"
/>
</span>
</a>
<span
class=
"line-body"
>
<xsl:apply-templates/>
</span>
</a>
<span
class=
"line-body"
>
<xsl:apply-templates
/>
</span>
<xsl:if
test=
"$correspondingNotes != ''"
>
<span>
<xsl:variable
name=
"noteIconId"
select=
"uuid:randomUUID()"
/>
<label
for=
"{$noteIconId}"
class=
"notes-icon"
/>
<input
type=
"checkbox"
id=
"{$noteIconId}"
/>
</span>
</xsl:if>
</div>
<xsl:if
test=
"$correspondingNotes != ''"
>
<div
class=
"note-container"
>
<ul>
<xsl:for-each
select=
"$correspondingNotes"
>
<xsl:apply-templates/>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</div>
</xsl:template>
<!-- LINE-PARTS -->
<xsl:template
match=
"g[not(@cert)]"
>
<span
class=
"g"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:template
match=
"g[not(@cert)]"
>
<span
class=
"g"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:apply-templates/>
</span>
</span>
</xsl:template>
<xsl:template
match=
"g[@cert]"
>
<span
class=
"g"
data-cert=
"{@cert}"
<xsl:template
match=
"g[@cert]"
>
<span
class=
"g"
data-cert=
"{@cert}"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:apply-templates/>
</span>
</span>
</xsl:template>
<xsl:template
match=
"metamark[contains(@rend, 'Line') or contains(@rend, 'line')]"
>
<xsl:variable
name=
"rend"
select=
"@rend"
/>
<hr
class=
"metamark-line {$rend}"
data-rend=
"{$rend}"
/>
</xsl:template>
<xsl:template
match=
"line//part"
>
<span
class=
"part"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:apply-templates
/>
<span
class=
"part"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template
match=
"line//seg"
>
<span
class=
"seg"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:apply-templates
/>
<span
class=
"seg"
id=
"{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}"
>
<xsl:apply-templates/>
</span>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<!-- notes -->
<xsl:template
match=
"facsimile/notes"
/>
<xsl:template
match=
"note"
>
<li
class=
"note-item"
>
<xsl:variable
name=
"noteItemId"
select=
"uuid:randomUUID()"
/>
<label
for=
"{$noteItemId}"
>
<xsl:value-of
select=
"@type"
/>
</label>
<input
id=
"{$noteItemId}"
type=
"checkbox"
/>
<span>
<xsl:apply-templates/>
</span>
</li>
</xsl:template>
</xsl:stylesheet>
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