From d63ed143edc0e47531cfd80fabd28a510e4df775 Mon Sep 17 00:00:00 2001
From: Martin de la Iglesia <iglesia@hab.de>
Date: Thu, 29 Aug 2024 11:19:37 +0000
Subject: [PATCH] Upload New File

---
 psnklassen.xsl | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 psnklassen.xsl

diff --git a/psnklassen.xsl b/psnklassen.xsl
new file mode 100644
index 0000000..fad5d8a
--- /dev/null
+++ b/psnklassen.xsl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Dieses Stylesheet ist Teil von
+
+Philipp Hainhofer: Das Große Stammbuch. Kommentierte digitale Edition eines bedeutenden Album Amicorum aus der Zeit um 1600 [Wolfenbütteler Digitale Editionen, Nr. 6], herausgegeben, transkribiert, übersetzt und kommentiert von Sabine Jagodzinski, Wolfenbüttel: Herzog August Bibliothek 2024, https://stammbuch.hab.de/stammbuch
+
+und wurde erstellt von Martin de la Iglesia (iglesia@hab.de).
+
+Es erzeugt den XHTML-Code für https://hainhofer.hab.de/register/klassifikation-zum-personenregister - eine Unterteilung des Personenregisters in die Berufskategorien im weitesten Sinn (Künstler - Architektur, Künstler - Malerei, Mythologischer Personen usw.) -->
+<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:xhtml="http://www.w3.org/1999/xhtml" version="2.0" exclude-result-prefixes="tei xs xhtml">
+    <xsl:strip-space elements="*"/>
+    <xsl:variable name="psnpath">personen/</xsl:variable>
+    
+    <xsl:template match="/">
+        <xsl:result-document href="psnklassen.xhtml">
+            <html xmlns="http://www.w3.org/1999/xhtml">
+                <head>                
+                    <title>Klassifikation zum Personenregister</title>
+                </head>
+                <body>                                       
+                        <xsl:for-each select="//tei:TEI/tei:teiHeader/tei:encodingDesc/tei:classDecl/tei:taxonomy/tei:category">
+                            <xsl:variable name="catid" select="@xml:id"/>                            
+                                <a>
+                                    <xsl:attribute name="href">
+                                        <xsl:value-of select="concat('#', $catid)"/>
+                                    </xsl:attribute>                                
+                                    <xsl:value-of select="tei:catDesc"/>
+                                </a>                           
+                            <xsl:if test="following-sibling::tei:category">
+                                <xsl:text> | </xsl:text>
+                            </xsl:if>
+                        </xsl:for-each>
+                    <xsl:apply-templates select="tei:TEI/tei:text/tei:body/tei:listPerson"/>
+                </body>
+            </html>
+        </xsl:result-document>
+    </xsl:template>
+    
+    <xsl:template match="tei:listPerson">       
+        <xsl:for-each select="//tei:TEI/tei:teiHeader/tei:encodingDesc/tei:classDecl/tei:taxonomy/tei:category">
+            <xsl:variable name="catid" select="@xml:id"/>
+            
+            <h2 xmlns="http://www.w3.org/1999/xhtml">
+                <xsl:attribute name="id">
+                    <xsl:value-of select="$catid"/>
+                </xsl:attribute>
+                <xsl:if test="parent::tei:category">
+                    <xsl:value-of select="parent::tei:category/tei:catDesc"/>
+                    <xsl:text>: </xsl:text>
+                </xsl:if>
+                <xsl:value-of select="tei:catDesc"/>
+            </h2>
+            <ul xmlns="http://www.w3.org/1999/xhtml">
+                <xsl:apply-templates select="document('stammb_psn.xml')//tei:person[tei:occupation[@code eq concat('#', $catid)]]">
+                    <xsl:sort select="tei:persName[@type='preferred']/tei:term/@sortKey"/>
+                </xsl:apply-templates>
+            </ul>              
+        </xsl:for-each>
+        
+    </xsl:template>
+    
+    <xsl:template match="tei:person">
+        <li xmlns="http://www.w3.org/1999/xhtml">
+            <a>
+                <xsl:attribute name="href">
+                    <xsl:value-of select="concat($psnpath, @xml:id)"/>
+                </xsl:attribute>             
+                
+                <xsl:choose>
+                    <xsl:when test="tei:persName[@type = 'preferred']/tei:term/tei:forename">
+                        <xsl:value-of select="tei:persName[@type = 'preferred']/tei:term/tei:surname"/><xsl:text>, </xsl:text><xsl:value-of select="tei:persName[@type = 'preferred']/tei:term/tei:forename"/>
+                    </xsl:when>
+                    <xsl:when test="tei:persName[@type = 'preferred']/tei:term/tei:name">
+                        <xsl:value-of select="tei:persName[@type = 'preferred']/tei:term/tei:name"/>
+                    </xsl:when>
+                </xsl:choose> 
+            </a>
+        </li>
+    </xsl:template>
+    
+</xsl:stylesheet>
-- 
GitLab