Created
November 9, 2024 19:34
-
-
Save jeffreycwitt/3c6c73b624000b6a94265d991aec8494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:tei="http://www.tei-c.org/ns/1.0" xpath-default-namespace="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="tei"> | |
<xsl:output method="xml" indent="no"/> | |
<xsl:variable name="commentaryslug"><xsl:value-of select="tokenize(//body/div/@xml:id, '-')[1]"/></xsl:variable> | |
<xsl:variable name="suffixpart"><xsl:value-of select="tokenize(//body/div/@xml:id, '-')[last()]"/></xsl:variable> | |
<xsl:template match="body//p"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="body//div"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-D', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="body//quote"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-Q', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="body//figure"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-F', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="body//name[not(parent::bibl)]"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-N', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="body//ref[not(parent::bibl)]"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-R', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="body//head"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:attribute name="xml:id"> | |
<xsl:value-of select="concat($commentaryslug, '-', $suffixpart, '-H', generate-id())"></xsl:value-of> | |
</xsl:attribute> | |
<xsl:apply-templates select="./@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<!-- IdentityTransform --> | |
<xsl:template match="@* | node()"> | |
<xsl:copy copy-namespaces="no"> | |
<xsl:apply-templates select="@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="div[@xml:id='include-list']"> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment