diff --git a/usas-annotation/insert-usas-annotations.xsl b/usas-annotation/insert-usas-annotations.xsl index 3586cc3a3f1d919ba09b827d2ebf3326fb78bdf5..a7bfdff7ccc1aaa0c6089710ea767e70cfa78082 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)) > 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="@*"/>