From f53818a1ce68251c5644d3107e398484237dbdd9 Mon Sep 17 00:00:00 2001
From: Daniel Jettka <sesv009@uni-hamburg.de>
Date: Sun, 7 Jun 2020 17:39:38 +0200
Subject: [PATCH] slight change in global variable containing utterances from
 Wmatrix

---
 usas-annotation/insert-usas-annotations.xsl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/usas-annotation/insert-usas-annotations.xsl b/usas-annotation/insert-usas-annotations.xsl
index 3586cc3..a7bfdff 100644
--- a/usas-annotation/insert-usas-annotations.xsl
+++ b/usas-annotation/insert-usas-annotations.xsl
@@ -30,9 +30,9 @@
     <!-- new tiers -->
     <xsl:variable name="pos-patterns" select="'.*', 'N.*', 'V.*'" as="xs:string+"/>
     <!-- the documents containing USAS-enriched utterances -->
-    <xsl:variable name="wmatrix-docs">
+    <xsl:variable name="wmatrix-utterances">
         <xsl:for-each select="$wmatrix-output-files">
-                <xsl:copy-of select="document(.)"/>
+            <xsl:copy-of select="document(.)//*:u"/>
         </xsl:for-each>
     </xsl:variable>
     
@@ -43,7 +43,7 @@
     
     <!-- Templates -->
     <xsl:template match="/">
-        <xsl:for-each select="distinct-values($wmatrix-docs//*:u/@file-ref)">       
+        <xsl:for-each select="distinct-values($wmatrix-utterances//*:u/@file-ref)">       
             <!-- overwrite the document -->
             <xsl:result-document href="{.}">
                 <xsl:for-each select="document(.)">
@@ -54,7 +54,7 @@
     </xsl:template>
     
     <!-- ISO/TEI-Spoken: insert a new tier with USAS annotation -->
-    <xsl:template match="*:spanGrp[exists(key('utterance-by-file-and-category-and-speaker', concat(base-uri(), '#', @type, '#', ../@who), $wmatrix-docs))]">
+    <xsl:template match="*:spanGrp[exists(key('utterance-by-file-and-category-and-speaker', concat(base-uri(), '#', @type, '#', ../@who), $wmatrix-utterances))]">
         
         <xsl:variable name="base-tier" select="." as="element()"/>
         <xsl:variable name="speaker" select="../@who" as="xs:string"/>
@@ -76,7 +76,7 @@
             
             <spanGrp type="{$new-tier-id}">
                 <xsl:for-each select="$base-tier/*:span">
-                    <xsl:variable name="value" select="string-join(key('words', concat(base-uri(), '#', $base-tier/@type, '#', $speaker, '#', @from, '#', @to), $wmatrix-docs)[matches(@pos, concat('^', $pos-pattern))]/@sem, ' ')" as="xs:string?"/>
+                    <xsl:variable name="value" select="string-join(key('words', concat(base-uri(), '#', $base-tier/@type, '#', $speaker, '#', @from, '#', @to), $wmatrix-utterances)[matches(@pos, concat('^', $pos-pattern))]/@sem, ' ')" as="xs:string?"/>
                     <xsl:if test="not(matches($value, '^\s*$'))">
                         <xsl:copy>
                             <xsl:copy-of select="@*"/>
@@ -92,7 +92,7 @@
     
     
     <!-- EXB: insert a new tier with USAS annotation -->
-    <xsl:template match="*:tier[exists(key('utterance-by-file-and-category-and-speaker', concat(base-uri(), '#', @category, '#', @speaker), $wmatrix-docs))]">
+    <xsl:template match="*:tier[exists(key('utterance-by-file-and-category-and-speaker', concat(base-uri(), '#', @category, '#', @speaker), $wmatrix-utterances))]">
         
         <xsl:variable name="base-tier" select="." as="element()"/>
         <xsl:variable name="exists-more-than-one-speaker" select="count(distinct-values(../*:tier/@speaker)) &gt; 1" as="xs:boolean"/>
@@ -114,7 +114,7 @@
             
             <tier id="{$new-tier-id}" speaker="{$base-tier/@speaker}" category="{$new-tier-category}" type="a" display-name="{$new-tier-id}">
                 <xsl:for-each select="$base-tier/*:event">
-                    <xsl:variable name="value" select="string-join(key('words', concat(base-uri(), '#', $base-tier/@category, '#', $base-tier/@speaker, '#', @start, '#', @end), $wmatrix-docs)[matches(@pos, concat('^', $pos-pattern))]/@sem, ' ')" as="xs:string?"/>
+                    <xsl:variable name="value" select="string-join(key('words', concat(base-uri(), '#', $base-tier/@category, '#', $base-tier/@speaker, '#', @start, '#', @end), $wmatrix-utterances)[matches(@pos, concat('^', $pos-pattern))]/@sem, ' ')" as="xs:string?"/>
                     <xsl:if test="not(matches($value, '^\s*$'))">
                         <xsl:copy>
                             <xsl:copy-of select="@*"/>
-- 
GitLab