Written Rewritten Transformation - milnegeneseo/digital-scholarly-editing GitHub Wiki

Run this transformation over each chapter file to generate a table for that chapter showing in which versions a paragraph segment was written or re-written.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://www.tei-c.org/ns/1.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="3.0" xmlns="http://www.w3.org/1999/xhtml">
    <xsl:output method="xml" indent="yes"></xsl:output>
    <xsl:template match="/"> 
        <!-- Run this transformation over each chapter file to generate a table for that chapter showing in which versions a paragraph segment was written or re-written. -->
        <html><head><title>Written and Re-written in Chapter 1</title></head>
            <body>
                <h2>Written and Re-written in Chapter 1</h2>
                <table>       <tr><th>Chap</th><th>Title</th><th>Par/Seg</th><th>Written</th><th>Re-written</th></tr>
                    <xsl:apply-templates select="//p/descendant::ab[@type eq 'parsed']"/> 
                </table>
            </body>
        </html>     
    </xsl:template>  
    <xsl:template match="ab[@type eq 'parsed']">
        <tr>
            <td><xsl:apply-templates select="seg[@type eq 'chapterNum']"/></td>
            <td><xsl:apply-templates select="seg[@type eq 'chapterTitle']"/></td>
            <td><xsl:apply-templates select="seg[@type eq 'paragraph']"/></td>
            <td><xsl:apply-templates select="seg[@type eq 'written']"/></td>
            <td><xsl:apply-templates select="seg[@type eq 'rewritten']"/></td> 
        </tr>
    </xsl:template>
</xsl:stylesheet>
⚠️ **GitHub.com Fallback** ⚠️