Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://doi.org/10.5281/zenodo.3378949
14 April 2025, 15:23:58 UTC
  • Code
  • Branches (0)
  • Releases (3)
  • Visits
    • Branches
    • Releases
      • 3
      • 3
      • 2
      • 1
    • 4d331d8
    • /
    • WeGA-ODD-4.12.0
    • /
    • xsl
    • /
    • to-tei_all.xsl
    Raw File Download
    Permalinks

    To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
    Select below a type of object currently browsed in order to display its associated SWHID and permalink.

    • content
    • directory
    • snapshot
    • release
    origin badgecontent badge Iframe embedding
    swh:1:cnt:a29e7d6081a59eb07426d0e9fc089760348adaa9
    origin badgedirectory badge Iframe embedding
    swh:1:dir:0d07c3d440d2dbd75b48f77bde6a147218b9921c
    origin badgesnapshot badge
    swh:1:snp:9086c578942bc286f19f598e8c14cd758274daa6
    origin badgerelease badge
    swh:1:rel:ef0e3d3f5d0428d4938d670891e6d533248c93d1
    Citations

    This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
    Select below a type of object currently browsed in order to generate citations for them.

    • content
    • directory
    • snapshot
    • release
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    to-tei_all.xsl
    <?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:wega="https://weber-gesamtausgabe.de/"
        xpath-default-namespace="http://www.tei-c.org/ns/1.0"
        xmlns="http://www.tei-c.org/ns/1.0"
        exclude-result-prefixes="xs wega"
        version="2.0">
        
        <xsl:param name="current-tei-version" as="xs:string">4.8.1</xsl:param>
        <xsl:param name="facsimileWhiteList" as="xs:string">D-B</xsl:param>
        
        <xsl:output media-type="application/tei+xml" encoding="UTF-8" indent="no" method="xml"/>
        <xsl:preserve-space elements="*"/>
        
        <xsl:variable name="biblioWrapper" as="element()">
            <TEI xmlns="http://www.tei-c.org/ns/1.0">
                <teiHeader>
                    <fileDesc>
                        <titleStmt>
                            <title level="s">WeGA, Bibliographie, Digitale Edition</title>
                            <title level='a'>Title</title>
                            <editor>Veit, Joachim</editor>
                            <editor>Stadler, Peter</editor>
                        </titleStmt>
                        <publicationStmt>
                            <publisher>
                                <name>Carl-Maria-von-Weber-Gesamtausgabe</name>
                                <address>
                                    <street>Hornsche Str. 39</street>
                                    <postCode>32756</postCode>
                                    <placeName>
                                        <country>D</country>
                                        <settlement>Detmold</settlement>
                                    </placeName>
                                </address>
                            </publisher>
                            <availability>
                                <licence target="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</licence>
                            </availability>
                        </publicationStmt>
                        <sourceDesc>
                            <p>Born digital</p>
                        </sourceDesc>
                    </fileDesc>
                </teiHeader>
                <text>
                    <body>
                        <listBibl>
                            <biblStruct></biblStruct>
                        </listBibl>
                    </body>
                </text>
            </TEI>
        </xsl:variable>
        
        <xsl:variable name="diariesWrapper" as="element()">
            <TEI xmlns="http://www.tei-c.org/ns/1.0">
                <teiHeader>
                    <fileDesc>
                        <titleStmt>
                            <title level="s">WeGA, Tagebücher, Digitale Edition</title>
                            <title level='a'>Title</title>
                            <author ref="https://weber-gesamtausgabe.de/A002068">Weber, Carl Maria von</author>
                            <editor>Veit, Joachim</editor>
                            <editor>Stadler, Peter</editor>
                            <respStmt>
                                <resp>Übertragung</resp>
                                <name>Dagmar Beck</name>
                            </respStmt>
                        </titleStmt>
                        <publicationStmt>
                            <publisher>
                                <name>Carl-Maria-von-Weber-Gesamtausgabe</name>
                                <address>
                                    <street>Hornsche Str. 39</street>
                                    <postCode>32756</postCode>
                                    <placeName>
                                        <country>D</country>
                                        <settlement>Detmold</settlement>
                                    </placeName>
                                </address>
                            </publisher>
                            <availability>
                                <licence target="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</licence>
                            </availability>
                        </publicationStmt>
                        <sourceDesc>
                            <msDesc>
                                <msIdentifier>
                                    <country>D</country>
                                    <settlement>Berlin</settlement>
                                    <repository n="D-B">Staatsbibliothek zu Berlin – Preußischer Kulturbesitz</repository>
                                    <idno>Mus. ms. autogr. theor. C. M. v. Weber WFN 1</idno>
                                </msIdentifier>
                            </msDesc>
                        </sourceDesc>
                    </fileDesc>
                    <encodingDesc>
                        <projectDesc>
                            <p>Carl-Maria-von-Weber-Gesamtausgabe</p>
                        </projectDesc>
                        <editorialDecl>
                            <p>The Transcription of the correspondence material follows the editorial principles of the Carl-Maria-von-Weber-Complete-Edition. For complete guidelines compare <ref target="http://weber-gesamtausgabe.de/de/Editionsrichtlinien">http://weber-gesamtausgabe.de/de/Editionsrichtlinien</ref>.
                            </p>
                        </editorialDecl>
                    </encodingDesc>
                </teiHeader>
                <text>
                    <body>
                        <ab></ab>
                    </body>
                </text>
            </TEI>
        </xsl:variable>
        
        <xsl:variable name="personsWrapper" as="element()">
            <TEI xmlns="http://www.tei-c.org/ns/1.0">
                <teiHeader>
                    <fileDesc>
                        <titleStmt>
                            <title level="s">WeGA, Personenbiogramme, Digitale Edition</title>
                            <title level='a'>Title</title>
                            <editor>Veit, Joachim</editor>
                            <editor>Stadler, Peter</editor>
                        </titleStmt>
                        <publicationStmt>
                            <publisher>
                                <name>Carl-Maria-von-Weber-Gesamtausgabe</name>
                                <address>
                                    <street>Hornsche Str. 39</street>
                                    <postCode>32756</postCode>
                                    <placeName>
                                        <country>D</country>
                                        <settlement>Detmold</settlement>
                                    </placeName>
                                </address>
                            </publisher>
                            <availability>
                                <licence target="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</licence>
                            </availability>
                        </publicationStmt>
                        <sourceDesc>
                            <p>Born digital</p>
                        </sourceDesc>
                    </fileDesc>
                </teiHeader>
                <text>
                    <body>
                        <listPerson>
                            <person></person>
                        </listPerson>
                    </body>
                </text>
            </TEI>
        </xsl:variable>
        
        <xsl:variable name="orgsWrapper" as="element()">
            <TEI xmlns="http://www.tei-c.org/ns/1.0">
                <teiHeader>
                    <fileDesc>
                        <titleStmt>
                            <title level="s">WeGA, Kurzbeschreibungen von Körperschaften, Digitale Edition</title>
                            <title level='a'>Title</title>
                            <editor>Veit, Joachim</editor>
                            <editor>Stadler, Peter</editor>
                        </titleStmt>
                        <publicationStmt>
                            <publisher>
                                <name>Carl-Maria-von-Weber-Gesamtausgabe</name>
                                <address>
                                    <street>Hornsche Str. 39</street>
                                    <postCode>32756</postCode>
                                    <placeName>
                                        <country>D</country>
                                        <settlement>Detmold</settlement>
                                    </placeName>
                                </address>
                            </publisher>
                            <availability>
                                <licence target="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</licence>
                            </availability>
                        </publicationStmt>
                        <sourceDesc>
                            <p>Born digital</p>
                        </sourceDesc>
                    </fileDesc>
                </teiHeader>
                <text>
                    <body>
                        <listOrg>
                            <org></org>
                        </listOrg>
                    </body>
                </text>
            </TEI>
        </xsl:variable>
        
        <xsl:variable name="placesWrapper" as="element()">
            <TEI xmlns="http://www.tei-c.org/ns/1.0">
                <teiHeader>
                    <fileDesc>
                        <titleStmt>
                            <title level="s">WeGA, Kurzbeschreibungen von Orten, Digitale Edition</title>
                            <title level='a'>Title</title>
                            <editor>Veit, Joachim</editor>
                            <editor>Stadler, Peter</editor>
                        </titleStmt>
                        <publicationStmt>
                            <publisher>
                                <name>Carl-Maria-von-Weber-Gesamtausgabe</name>
                                <address>
                                    <street>Hornsche Str. 39</street>
                                    <postCode>32756</postCode>
                                    <placeName>
                                        <country>D</country>
                                        <settlement>Detmold</settlement>
                                    </placeName>
                                </address>
                            </publisher>
                            <availability>
                                <licence target="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</licence>
                            </availability>
                        </publicationStmt>
                        <sourceDesc>
                            <p>Born digital</p>
                        </sourceDesc>
                    </fileDesc>
                </teiHeader>
                <text>
                    <body>
                        <listPlace>
                            <place></place>
                        </listPlace>
                    </body>
                </text>
            </TEI>
        </xsl:variable>
        
        <xsl:variable name="duplicatesWrapper" as="element()">
            <TEI xmlns="http://www.tei-c.org/ns/1.0">
                <teiHeader>
                    <fileDesc>
                        <titleStmt>
                            <title level="s">WeGA, Digitale Edition</title>
                            <title level='a'>Duplikat</title>
                            <editor>Veit, Joachim</editor>
                            <editor>Stadler, Peter</editor>
                        </titleStmt>
                        <publicationStmt>
                            <publisher>
                                <name>Carl-Maria-von-Weber-Gesamtausgabe</name>
                                <address>
                                    <street>Hornsche Str. 39</street>
                                    <postCode>32756</postCode>
                                    <placeName>
                                        <country>D</country>
                                        <settlement>Detmold</settlement>
                                    </placeName>
                                </address>
                            </publisher>
                            <availability>
                                <licence target="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</licence>
                            </availability>
                        </publicationStmt>
                        <sourceDesc>
                            <p>born digital</p>
                        </sourceDesc>
                    </fileDesc>
                </teiHeader>
                <text>
                    <body>
                        <p>Dies ist ein Duplikat!</p>
                    </body>
                </text>
            </TEI>
        </xsl:variable>
        
        <xsl:variable name="tagsDecl" as="element()">
            <tagsDecl>
                <rendition xml:id="latintype" scheme="css">font-style: italic;</rendition>
                <rendition xml:id="italic" scheme="css">font-style: italic;</rendition>
                <rendition xml:id="underline" scheme="css">text-decoration: underline;</rendition>
                <rendition xml:id="superscript" scheme="css">vertical-align: super; font-size: 0.8em; line-height: 0.7em;</rendition>
                <rendition xml:id="subscript" scheme="css">vertical-align: sub; font-size: 0.8em; line-height: 0.7em;</rendition>
                <rendition xml:id="center" scheme="css">display: block; text-align: center;</rendition>
                <rendition xml:id="right" scheme="css">display: block; text-align: right;</rendition>
                <rendition xml:id="antiqua" scheme="css">font-style: italic;</rendition>
                <rendition xml:id="left" scheme="css">display: block; text-align: left;</rendition>
                <rendition xml:id="spaced_out" scheme="css">letter-spacing: 0.15em;</rendition>
                <rendition xml:id="smaller" scheme="css">font-size: smaller;</rendition>
                <rendition xml:id="bold" scheme="css">font-weight: bold;</rendition>
                <rendition xml:id="small-caps" scheme="css">font-variant: small-caps;</rendition>
                <rendition xml:id="double-quotes-before" scheme="css" scope="before">content: '&quot;'</rendition>
                <rendition xml:id="double-quotes-after" scheme="css" scope="after">content: '&quot;'</rendition>
                <rendition xml:id="single-quotes-before" scheme="css" scope="before">content: "&apos;";</rendition>
                <rendition xml:id="single-quotes-after" scheme="css" scope="after">content: "&apos;";</rendition>
            </tagsDecl>
        </xsl:variable>
        
        <xsl:template match="node() | @*" mode="#all">
            <xsl:copy>
                <xsl:apply-templates select="node() | @*" mode="#current"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="processing-instruction()" priority="1"/>
        
        <xsl:template match="workName" mode="#all">
            <xsl:element name="name">
                <xsl:attribute name="type">artificialWork</xsl:attribute>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:element>
        </xsl:template>
        
        <xsl:template match="characterName" mode="#all">
            <xsl:element name="name">
                <xsl:attribute name="type">character</xsl:attribute>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:element>
        </xsl:template>
        
        <xsl:template match="footNote" mode="#all">
            <xsl:element name="note">
                <xsl:attribute name="type">original</xsl:attribute>
                <xsl:attribute name="place">bottom</xsl:attribute>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:element>
        </xsl:template>
        
        <xsl:template match="address[parent::div]" mode="#all">
            <xsl:element name="ab">
                <xsl:copy>
                    <xsl:apply-templates select="@*|node()"/>
                </xsl:copy>
            </xsl:element>
        </xsl:template>
        
        <xsl:template match="ab[parent::document-node()]" mode="#default">
            <xsl:apply-templates select="$diariesWrapper" mode="diaries">
                <xsl:with-param name="curNode" select="." tunnel="yes"/>
            </xsl:apply-templates>
        </xsl:template>
        
        <xsl:template match="person[parent::document-node()]" mode="#default">
            <xsl:apply-templates select="$personsWrapper" mode="persons">
                <xsl:with-param name="curNode" select="." tunnel="yes"/>
            </xsl:apply-templates>
        </xsl:template>
        
        <xsl:template match="org[parent::document-node()]" mode="#default">
            <xsl:apply-templates select="$orgsWrapper" mode="orgs">
                <xsl:with-param name="curNode" select="." tunnel="yes"/>
            </xsl:apply-templates>
        </xsl:template>
        
        <xsl:template match="place[parent::document-node()]" mode="#default">
            <xsl:apply-templates select="$placesWrapper" mode="places">
                <xsl:with-param name="curNode" select="." tunnel="yes"/>
            </xsl:apply-templates>
        </xsl:template>
        
        <xsl:template match="biblStruct[parent::document-node()]" mode="#default">
            <xsl:choose>
                <xsl:when test="ref">
                    <xsl:apply-templates select="$duplicatesWrapper"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:apply-templates select="$biblioWrapper" mode="biblio">
                        <xsl:with-param name="curNode" select="." tunnel="yes"/>
                    </xsl:apply-templates>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        
        <xsl:template match="document-node()">
            <xsl:call-template name="inject-schema-references">
                <xsl:with-param name="schema-URL">http://www.tei-c.org/Vault/P5/<xsl:value-of select="$current-tei-version"/>/xml/tei/custom/schema/relaxng/tei_all.rng</xsl:with-param>
            </xsl:call-template>
            <xsl:apply-templates/>
        </xsl:template>
        
        <xsl:template match="TEI" mode="biblio diaries persons orgs places">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="$curNode/@xml:id"/>
                <xsl:apply-templates mode="#current"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="TEI[ref]" priority="10">
            <xsl:apply-templates select="$duplicatesWrapper"/>
        </xsl:template>
        
        <xsl:template match="teiHeader" mode="#all">
            <xsl:copy>
                <xsl:choose>
                    <xsl:when test="encodingDesc">
                        <xsl:apply-templates mode="#default"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:apply-templates select="node() except revisionDesc"/>
                        <xsl:element name="encodingDesc">
                            <xsl:apply-templates select="$tagsDecl" mode="#default"/>
                        </xsl:element>
                        <xsl:apply-templates select="revisionDesc" mode="#default"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="publicationStmt[parent::fileDesc]" mode="#all">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:variable name="id">
                <xsl:choose>
                    <xsl:when test="$curNode">
                        <xsl:value-of select="$curNode/@xml:id"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="./root()/*/@xml:id"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:copy>
                <xsl:apply-templates select="@* | node() except idno[@type='WeGA']" mode="#default"/>
                <idno type="WeGA">
                    <xsl:comment> *** This is the permanent identifier for this document *** </xsl:comment>
                    <xsl:comment> *** Please cite this URI when referring to it *** </xsl:comment>
                    <xsl:value-of select="concat('http://weber-gesamtausgabe.de/', $id)"/>
                </idno>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="encodingDesc" mode="#all">
            <xsl:copy>
                <xsl:apply-templates/>
                <xsl:apply-templates select="$tagsDecl" mode="#default"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="title[@level='a']" mode="biblio diaries persons orgs places">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="@level" mode="#default"/>
                <xsl:choose>
                    <xsl:when test="$curNode/self::ab">
                        <xsl:value-of select="concat('Tagebucheintrag vom ', format-date($curNode/@n cast as xs:date, '[D]. [MNn] [Y]', 'de', (), ()))"/>
                    </xsl:when>
                    <xsl:when test="$curNode/self::person">
                        <xsl:value-of select="concat('Personeneintrag für ', normalize-space($curNode//persName[@type='reg']))"/>
                    </xsl:when>
                    <xsl:when test="$curNode/self::org">
                        <xsl:value-of select="concat('Kurzbeschreibung für ', normalize-space($curNode//orgName[@type='reg']))"/>
                    </xsl:when>
                    <xsl:when test="$curNode/self::place">
                        <xsl:value-of select="concat('Kurzbeschreibung für ', normalize-space($curNode//placeName[@type='reg']))"/>
                    </xsl:when>
                    <xsl:when test="$curNode/self::biblStruct">
                        <xsl:value-of select="'Bibliographieeintrag'"/>
                    </xsl:when>
                </xsl:choose>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="ab" mode="diaries">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="$curNode/@n | $curNode/node()  except $curNode/ref" mode="#default"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="person" mode="persons">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="$curNode/node() except $curNode/ref" mode="#default"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="org" mode="orgs">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="$curNode/node() except $curNode/ref" mode="#default"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="place" mode="places">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="$curNode/node() except $curNode/ref" mode="#default"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="biblStruct" mode="biblio">
            <xsl:param name="curNode" tunnel="yes"/>
            <xsl:copy>
                <xsl:apply-templates select="$curNode/node() except $curNode/ref" mode="#default"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="list[parent::event]">
            <xsl:element name="p">
                <xsl:copy>
                    <xsl:apply-templates select="@*|node()"/>
                </xsl:copy>
            </xsl:element>
        </xsl:template>
        
        <xsl:template match="facsimile">
            <xsl:variable name="wit" select="wega:facsimile-witness(.)"/>
            <xsl:if test="$wit//repository[@n = tokenize($facsimileWhiteList, '\s+')] or @sameAs">
                <xsl:copy>
                    <xsl:apply-templates select="@*"/>
                    <!-- 
                    inject an empty surface element for those facsimile elements
                    where we only provide a @sameAs link to an IIIF manifest
                -->
                    <xsl:if test="not(*)">
                        <xsl:element name="surface"/>
                    </xsl:if>
                    <xsl:apply-templates/>
                </xsl:copy>
            </xsl:if>
        </xsl:template>
        
        <xsl:template match="graphic[not(@url)][@sameAs]">
            <xsl:copy>
                <!-- turn sameAs references (to IIIF manifests) into urls -->
                <xsl:apply-templates select="@* except @sameAs"/>
                <xsl:attribute name="url" select="@sameAs"/>
            </xsl:copy>
        </xsl:template>
        
        <xsl:template match="@rend">
            <xsl:choose>
                <xsl:when test="ends-with(., 'quotes')">
                    <xsl:attribute name="rendition" select="concat('#',.,'-before #', ., '-after')"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="rendition" select="concat('#',.)"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        
        <xsl:template match="@key[matches(., 'A[A-F0-9]{6}')]" mode="#all">
            <xsl:attribute name="ref" select="replace(., '(A[A-F0-9]{6})', 'https://weber-gesamtausgabe.de/$1')"/>
        </xsl:template>
        
        <xsl:template match="@ref[matches(., 'wega:')]" mode="#all">
            <xsl:attribute name="ref" select="replace(., 'wega:', 'https://weber-gesamtausgabe.de/')"/>
        </xsl:template>
        
        <xsl:template match="@url" mode="#all">
            <xsl:attribute name="url">
                <xsl:choose>
                    <xsl:when test="matches(., 'wega:')">
                        <xsl:value-of select="replace(., 'wega:', 'https://weber-gesamtausgabe.de/Scaler/IIIF/')"/>
                    </xsl:when>
                    <xsl:when test="starts-with(., 'http')">
                        <xsl:value-of select="."/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:variable name="curID" select="root()/*/data(@xml:id)"/>
                        <xsl:variable name="docType" select="wega:docType($curID)"/>
                        <xsl:variable name="pathSegment" select="encode-for-uri(string-join(($docType, concat(substring($curID,1,5), 'xx'), $curID, .), '/'))"/>
                        <xsl:value-of select="concat('https://weber-gesamtausgabe.de/Scaler/IIIF/', $pathSegment, '/full/,600/0/native.jpg')"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
        </xsl:template>
        
        <xsl:template match="@notInvolved" mode="#all"/>
        <xsl:template match="@full[parent::author]" mode="#all"/>
        <xsl:template match="keywords[parent::biblStruct]" mode="#all"/>
        
        <xsl:template name="inject-schema-references">
            <xsl:param name="schema-URL" as="xs:string"/>
            <xsl:text>&#10;</xsl:text>
            <xsl:processing-instruction name="xml-model">href="<xsl:value-of select="$schema-URL"/>" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"</xsl:processing-instruction>
            <xsl:text>&#10;</xsl:text>
            <xsl:processing-instruction name="xml-model">href="<xsl:value-of select="$schema-URL"/>" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"</xsl:processing-instruction>
            <xsl:text>&#10;</xsl:text>
        </xsl:template>
        
        <xsl:function name="wega:docType" as="xs:string?">
            <xsl:param name="id" as="xs:string"/>
            <xsl:choose>
                <xsl:when test="matches($id, 'A00[A-F0-9]{4}')">persons</xsl:when>
                <xsl:when test="matches($id, 'A02\d{4}')">works</xsl:when>
                <xsl:when test="matches($id, 'A03\d{4}')">writings</xsl:when>
                <xsl:when test="matches($id, 'A04\d{4}')">letters</xsl:when>
                <xsl:when test="matches($id, 'A05\d{4}')">news</xsl:when>
                <xsl:when test="matches($id, 'A06\d{4}')">diaries</xsl:when>
                <xsl:when test="matches($id, 'A07\d{4}')">var</xsl:when>
                <xsl:when test="matches($id, 'A08\d{4}')">orgs</xsl:when>
                <xsl:when test="matches($id, 'A09\d{4}')">thematicCommentaries</xsl:when>
                <xsl:when test="matches($id, 'A10\d{4}')">documents</xsl:when>
                <xsl:when test="matches($id, 'A11\d{4}')">biblio</xsl:when>
                <xsl:when test="matches($id, 'A13\d{4}')">places</xsl:when>
                <xsl:when test="matches($id, 'A22\d{4}')">sources</xsl:when>
            </xsl:choose>
        </xsl:function>
        
        <xsl:function name="wega:facsimile-witness" as="element()?">
            <xsl:param name="facsimile" as="element(facsimile)"/>
            <xsl:variable name="sourceID" select="substring($facsimile/@source, 2)"/>
            <xsl:variable name="source" as="element()">
                <xsl:choose>
                    <xsl:when test="$sourceID">
                        <xsl:sequence select="$facsimile/preceding::sourceDesc//*[@xml:id=$sourceID]"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:sequence select="$facsimile/preceding::sourceDesc/*"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:choose>
                <xsl:when test="$source[self::witness]">
                    <xsl:sequence select="$source/*"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:sequence select="$source"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:function>
        
    </xsl:stylesheet>

    back to top

    Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
    The source code of Software Heritage itself is available on our development forge.
    The source code files archived by Software Heritage are available under their own copyright and licenses.
    Terms of use: Archive access, API— Contact— JavaScript license information— Web API