From 16a710225f858816709631a2d9cddfd7188fd343 Mon Sep 17 00:00:00 2001
From: Max-Ferdinand Zeterberg <zeterberg@sub.uni-goettingen.de>
Date: Wed, 17 Apr 2024 15:08:39 +0200
Subject: [PATCH] feat(hi): implement serialization to HTML feat(p): implement
 serialization to HTML

---
 .../edxml2html/libs/html-shared-templates.xsl | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 scenarios/xslt/edxml2html/libs/html-shared-templates.xsl

diff --git a/scenarios/xslt/edxml2html/libs/html-shared-templates.xsl b/scenarios/xslt/edxml2html/libs/html-shared-templates.xsl
new file mode 100644
index 0000000..75fbfc7
--- /dev/null
+++ b/scenarios/xslt/edxml2html/libs/html-shared-templates.xsl
@@ -0,0 +1,53 @@
+<?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="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="xs"
+    version="2.0" xpath-default-namespace="http://sub.uni-goettingen.de/edxml#">
+    
+    <!--  Highlightings  -->
+    
+    <xsl:template match="hi[@rend='italics']|hi[not(@rend)]">
+        <span class="hi italics"
+            id="{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}">
+            <xsl:apply-templates/>
+        </span>
+    </xsl:template>
+    
+    <xsl:template match="hi[@rend='bold']">
+        <span class="hi bold"
+            id="{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}">
+            <xsl:apply-templates/>
+        </span>
+    </xsl:template>
+    
+    <xsl:template match="hi[@rend='sub']">
+        <sub class="hi sub"
+            id="{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}">
+            <xsl:apply-templates/>
+        </sub>
+    </xsl:template>
+    
+    <xsl:template match="hi[@rend='super']">
+        <sup class="hi sup"
+            id="{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}">
+            <xsl:apply-templates/>
+        </sup>
+    </xsl:template>    
+    
+    <xsl:template match="hi[@rend='under']">
+        <span class="hi under"
+            id="{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}">
+            <xsl:apply-templates/>
+        </span>
+    </xsl:template>
+    
+    <!--  Paragraphs  -->
+    
+    <xsl:template match="p">
+        <p id="{if(@xml:id) then (@xml:id) else ('part_'||generate-id(.))}">
+            <xsl:apply-templates/>
+        </p>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file
-- 
GitLab