Skip to content

Commit

Permalink
optimize copying in old changes for lemma
Browse files Browse the repository at this point in the history
reduces overall processing time by 80% 🥳
  • Loading branch information
olvidalo committed Jul 12, 2024
1 parent 70f8321 commit 716c191
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions staging/library/transformation/6-build-teiHeader.xsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?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"
exclude-result-prefixes="xs"
xmlns:tei="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="xs tei"
version="2.0">

<!--
Expand All @@ -21,8 +22,11 @@
<xsl:param name="comparisonBase"/>
<xsl:param name="quot">"</xsl:param>

<!-- <xsl:key name="entry-by-id" match="tei:entry" use="@xml:id"/>-->

<xsl:variable name="files" select="collection(concat('../../../',$comparisonBase,'/?recurse=yes;select=wl-*.xml'))"/>


<xsl:template match="/">
<xsl:message><xsl:value-of select="current-dateTime() || ' – ' || static-base-uri()"/></xsl:message>
<xsl:processing-instruction name="xml-model"><xsl:value-of select="concat('href=',$quot,$schemaPath,'/papyri-wl.rng',$quot,' type=',$quot,'application/xml',$quot,' schematypens=',$quot,'http://relaxng.org/ns/structure/1.0',$quot)"/></xsl:processing-instruction>
Expand Down Expand Up @@ -121,7 +125,21 @@
</change>
<!-- inherit existing changes -->
<xsl:variable name="currentID" select="*:entry/@xml:id"/>
<xsl:apply-templates select="$files//*:TEI[*:text//*:entry[@xml:id = $currentID]]/*:teiHeader/*:revisionDesc/*:change"/>
<xsl:copy-of select="$files/id($currentID)/../../../../tei:teiHeader/tei:revisionDesc/tei:change"/>


<!-- the following left in for reference: tested alternatives to original XPath to reduce processing time -->
<!-- 112s -->
<!-- <xsl:copy-of select="$files/key('entry-by-id', $currentID)/../../../tei:teiHeader/tei:revisionDesc/tei:change"/>-->
<!-- 105s -->
<!-- <xsl:copy-of select="$files/tei:TEI[key('entry-by-id', $currentID)]/tei:teiHeader/tei:revisionDesc/tei:change"/>-->
<!-- 148s, 120s -->
<!-- <xsl:copy-of select="$files/tei:TEI[tei:text/tei:body/tei:div/tei:entry[@xml:id = $currentID]]/tei:teiHeader/tei:revisionDesc/tei:change"/>-->
<!-- 250s -->
<!-- <xsl:apply-templates select="$files/tei:TEI[tei:text/tei:body/tei:div/tei:entry[@xml:id = $currentID]]/tei:teiHeader/tei:revisionDesc/tei:change"/>-->


<!-- <xsl:apply-templates select="$files/tei:TEI[key('entry-by-id', $currentID)]/tei:teiHeader/tei:revisionDesc/tei:change"/>-->

<!-- initial changes; removed after first run -->
<!--
Expand Down

0 comments on commit 716c191

Please sign in to comment.