<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    exclude-result-prefixes="svg xlink xs" version="2.0">

    <xd:doc scope="stylesheet">
        <xd:desc>
            <xd:p><xd:b>Created on:</xd:b>July 2, 2014</xd:p>
            <xd:p><xd:b>Author:</xd:b> <NAME></xd:p>
            <xd:p><xd:b>Modified on:</xd:b>May 5, 2015</xd:p>
            <xd:p><xd:b>Modified by:</xd:b> Dot Porter</xd:p>
            <xd:p>This document takes as its input the output from process5.xsl. It pulls image file
                URLs from an external XML file (saved from Microsoft Excel and named
                @idno-imageList.xml) up into <left/> and <right/>. </xd:p>
        </xd:desc>
    </xd:doc>

    <xsl:template match="@*|node()|comment() " priority="-1" mode="#all">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()|comment()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:variable name="idno" select="manuscript/@idno"/>

    <xsl:template match="manuscript">
        <manuscript idno="{$idno}" msname="{@msname}" msURL="{@msURL}">

            <xsl:for-each select="quire">
                <quire>
                    <xsl:attribute name="n">
                        <xsl:value-of select="@n"/>
                    </xsl:attribute>
                    <xsl:attribute name="positions">
                        <xsl:value-of select="@positions"/>
                    </xsl:attribute>
                    <units>
                        <xsl:apply-templates select="units"/>
                    </units>
                </quire>
            </xsl:for-each>
        </manuscript>
    </xsl:template>

    <xsl:template match="units">
        <xsl:for-each select="unit">
            <unit>
                <xsl:attribute name="n" select="@n"/>
                <inside>
                    <xsl:apply-templates select="inside"/>
                </inside>
                <outside>
                    <xsl:apply-templates select="outside"/>
                </outside>
            </unit>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="inside">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="outside">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="left">
        <left>
            <xsl:if test="@mode">
                <xsl:attribute name="mode">
                    <xsl:value-of select="@mode"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="@folNo">
                <xsl:attribute name="folNo">
                    <xsl:value-of select="@folNo"/>
                </xsl:attribute>
            </xsl:if>
            
            <xsl:variable name="the_folNo">
                <xsl:value-of select="@folNo"/>
            </xsl:variable>
            <xsl:if test="document(concat('../',$idno,'-imageList.xml'))//ss:Row/ss:Cell/ss:Data/$the_folNo"> <!--test="ancestor::quires/tei:facsimile/tei:surface[@n=$the_folNo]"-->
                <xsl:attribute name="url">
                    <!--<xsl:value-of
                        select="document(concat($idno,'-imageList.xml'))//ss:Row/ss:Cell/ss:Data/$the_folNo/../following-sibling::ss:Cell[1]/ss:Data[1]/text()"/>-->
                    <xsl:value-of
                        select="document(concat('../',$idno,'-imageList.xml'))//ss:Row/ss:Cell/ss:Data[text()=$the_folNo]/../following-sibling::ss:Cell[1]/ss:Data[1]/text()"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="@mode='missing'">
                <xsl:attribute name="url">https://raw.githubusercontent.com/leoba/VisColl/master/data/support/images/x.jpg</xsl:attribute>
            </xsl:if>
            <xsl:attribute name="pos">
                <xsl:value-of select="@pos"/>
            </xsl:attribute>
        </left>
    </xsl:template>

    <xsl:template match="right">
        <right>
            <xsl:if test="@mode">
                <xsl:attribute name="mode">
                    <xsl:value-of select="@mode"/>
                </xsl:attribute>
            </xsl:if><commit_msg>modified for testing<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    exclude-result-prefixes="svg xlink xs" version="2.0">

    <xd:doc scope="stylesheet">
        <xd:desc>
            <xd:p><xd:b>Created on:</xd:b>July 2, 2014</xd:p>
            <xd:p><xd:b>Author:</xd:b> Dot Porter</xd:p>
            <xd:p><xd:b>Modified on:</xd:b>May 5, 2015</xd:p>
            <xd:p><xd:b>Modified by:</xd:b> Dot Porter</xd:p>
            <xd:p>This document takes as its input the output from process5.xsl. It pulls image file
                URLs from an external XML file (saved from Microsoft Excel and named
                @idno-imageList.xml) up into <left/> and <right/>. </xd:p>
        </xd:desc>
    </xd:doc>

    <xsl:template match="@*|node()|comment() " priority="-1" mode="#all">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()|comment()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:variable name="idno" select="manuscript/@idno"/>

    <xsl:template match="manuscript">
        <manuscript idno="{$idno}" msname="{@msname}" msURL="{@msURL}">

            <xsl:for-each select="quire">
                <quire>
                    <xsl:attribute name="n">
                        <xsl:value-of select="@n"/>
                    </xsl:attribute>
                    <xsl:attribute name="positions">
                        <xsl:value-of select="@positions"/>
                    </xsl:attribute>
                    <units>
                        <xsl:apply-templates select="units"/>
                    </units>
                </quire>
            </xsl:for-each>
        </manuscript>
    </xsl:template>

    <xsl:template match="units">
        <xsl:for-each select="unit">
            <unit>
                <xsl:attribute name="n" select="@n"/>
                <inside>
                    <xsl:apply-templates select="inside"/>
                </inside>
                <outside>
                    <xsl:apply-templates select="outside"/>
                </outside>
            </unit>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="inside">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="outside">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="left">
        <left>
            <xsl:if test="@mode">
                <xsl:attribute name="mode">
                    <xsl:value-of select="@mode"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="@folNo">
                <xsl:attribute name="folNo">
                    <xsl:value-of select="@folNo"/>
                </xsl:attribute>
            </xsl:if>
            
            <xsl:variable name="the_folNo">
                <xsl:value-of select="@folNo"/>
            </xsl:variable>
            <!--<xsl:if test="document(concat('../',$idno,'-imageList.xml'))//ss:Row/ss:Cell/ss:Data/$the_folNo">
                <xsl:attribute name="url">
                    <xsl:value-of
                        select="document(concat('../',$idno,'-imageList.xml'))//ss:Row/ss:Cell/ss:Data[text()=$the_folNo]/../following-sibling::ss:Cell[1]/ss:Data[1]/text()"/>
                </xsl:attribute>
            </xsl:if>-->
            <xsl:if test="document(http://dorpdev.library.upenn.edu/test/CottonMSClaudiusBIV-imageList.xml)//ss:Row/ss:Cell/ss:Data/$the_folNo">
                <xsl:attribute name="url">
                    <xsl:value-of
                        select="document(http://dorpdev.library.upenn.edu/test/CottonMSClaudiusBIV-imageList.xml)//ss:Row/ss:Cell/ss:Data[text()=$the_folNo]/../following-sibling::ss:Cell[1]/ss:Data[1]/text()"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="@mode='missing'">
                <xsl:attribute name="url">https://raw.githubusercontent.com/leoba/VisColl/master/data/support/images/x.jpg</xsl:attribute>
            </xsl:if>
            <xsl:attribute name="pos">
                <xsl:value-of select="@pos"/>
            </xsl:attribute>
        </left>
    </xsl:template>

    <xsl:template match="right">
        <right>
            <xsl:if test="@mode">
                <xsl:attribute name="mode">
                    <xsl:value-of select="@mode"/>
                </xsl:attribute>
            </xsl:if>
{'fraction_non_alphanumeric': 0.18252470300877097, 'fraction_numerical': 0.009104030198734318, 'mean_word_length': 1.7862666254253017, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 2, '>': 221, 'https://': 2, 'lorem ipsum': 0, 'www.': 10, 'xml': 25}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7632567', 'n_tokens_mistral': 3077, 'n_tokens_neox': 2698, 'n_words': 387}