commiting the state after minor refactoring of parameter/variable names, still before eliminating ann_segmentation

Change-Id: Ia3f9eebf0e54b4ba64244eec57d43f36e94caac7
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
index c3d7e7c..8ca8964 100644
--- a/nkjp2korap.xsl
+++ b/nkjp2korap.xsl
@@ -383,18 +383,18 @@
         <xsl:otherwise>
 
           <xsl:call-template name="process_single_sample">
-            <xsl:with-param name="text.xml" as="document-node()" select="."/>
-            <xsl:with-param name="ann_morphosyntax.xml" as="document-node()"
+            <xsl:with-param name="text.doc" as="document-node()" select="."/>
+            <xsl:with-param name="ann_morphosyntax.doc" as="document-node()"
               select="doc($ann_morphosyntax.uri)"/>
             <xsl:with-param name="ann_segmentation.xml" as="document-node()"
               select="doc($ann_segmentation.uri)"/>
             <xsl:with-param name="my_textID" select="$my_textID" as="xs:string"/>
             <!-- the following parameters may happen to be null  -->
-            <xsl:with-param name="ann_named.xml" as="document-node()*"
+            <xsl:with-param name="ann_named.doc" as="document-node()*"
               select="if(fn:doc-available($ann_named.uri)) then doc($ann_named.uri) else ()"/>
-            <xsl:with-param name="ann_groups.xml" as="document-node()*"
+            <xsl:with-param name="ann_groups.doc" as="document-node()*"
               select="if(fn:doc-available($ann_groups.uri)) then doc($ann_groups.uri) else ()"/>
-            <xsl:with-param name="ann_words.xml" as="document-node()*"
+            <xsl:with-param name="ann_words.doc" as="document-node()*"
               select="if(fn:doc-available($ann_words.uri)) then doc($ann_words.uri) else ()"/>
             
           </xsl:call-template>
@@ -404,14 +404,14 @@
   </xsl:template>
   
   <xsl:template name="process_single_sample">
-    <xsl:param name="text.xml" as="document-node()"/>
-    <xsl:param name="ann_morphosyntax.xml" as="document-node()"/>
+    <xsl:param name="text.doc" as="document-node()"/>
+    <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
     <xsl:param name="ann_segmentation.xml" as="document-node()"/>
     <xsl:param name="my_textID" as="xs:string" select="'0-BAD_textID'"/>
     <!-- empty textID should never happen, but if it does, it will be signalled at the top of the output   -->
-    <xsl:param name="ann_named.xml" as="document-node()*"/>
-    <xsl:param name="ann_groups.xml" as="document-node()*"/>
-    <xsl:param name="ann_words.xml" as="document-node()*"/>
+    <xsl:param name="ann_named.doc" as="document-node()*"/>
+    <xsl:param name="ann_groups.doc" as="document-node()*"/>
+    <xsl:param name="ann_words.doc" as="document-node()*"/>
     
     <xsl:variable name="targetBaseDir" as="xs:string" select="$targetCorpusDir_slashed || $docID || '/' || $my_textID"/>
     
@@ -437,21 +437,21 @@
       <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
       <xsl:with-param name="ann_segmentation.xml" select="$ann_segmentation.xml"
         as="document-node()"/>
-      <xsl:with-param name="ann_morphosyntax.xml" select="$ann_morphosyntax.xml"
+      <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
         as="document-node()"/>
       <xsl:with-param name="target" select="$targetBaseDir ||  '/nkjp/morpho.xml'" as="xs:string"/>
     </xsl:call-template>
 
     <xsl:call-template name="create_text_header">
-      <xsl:with-param name="text.xml" select="$text.xml" as="document-node()"/>
+      <xsl:with-param name="text.doc" select="$text.doc" as="document-node()"/>
       <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
       <xsl:with-param name="target" select="$targetBaseDir ||  '/header.xml'" as="xs:string"/>
     </xsl:call-template>
 
-    <xsl:if test="$ann_named.xml">
+    <xsl:if test="$ann_named.doc">
       <xsl:variable name="rev_lookup-seq" as="map(*)+">
           <xsl:for-each
-            select="$ann_named.xml//tei:seg/tei:ptr">
+            select="$ann_named.doc//tei:seg/tei:ptr">
             <xsl:variable name="trg" as="xs:string" select="fn:substring-before(@target, '#')"/>
             <!-- caution: as of 01-June-2022, some of the pointers are malformed (missing '#' when referencing locally).
              so we need to act around it but also sustainably - in case that error gets corrected -->
@@ -468,25 +468,25 @@
       
       <xsl:call-template name="create_named">
         <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
-        <xsl:with-param name="ann_morphosyntax.xml" select="$ann_morphosyntax.xml"
+        <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
           as="document-node()"/>
-        <xsl:with-param name="ann_named.xml" select="$ann_named.xml"
+        <xsl:with-param name="ann_named.doc" select="$ann_named.doc"
           as="document-node()"/>
         <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/named.xml'" as="xs:string"/>
         <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)"/>
       </xsl:call-template>
     </xsl:if>
 
-    <xsl:if test="$ann_words.xml and $ann_groups.xml">
+    <xsl:if test="$ann_words.doc and $ann_groups.doc">
       <xsl:call-template name="create_groups">
         <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
         <xsl:with-param name="ann_segmentation.xml" select="$ann_segmentation.xml"
           as="document-node()"/>
-        <xsl:with-param name="ann_morphosyntax.xml" select="$ann_morphosyntax.xml"
+        <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
           as="document-node()"/>
-        <xsl:with-param name="ann_words.xml" select="$ann_words.xml"
+        <xsl:with-param name="ann_words.doc" select="$ann_words.doc"
           as="document-node()"/>
-        <xsl:with-param name="ann_groups.xml" select="$ann_groups.xml"
+        <xsl:with-param name="ann_groups.doc" select="$ann_groups.doc"
           as="document-node()"/>
         <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/groups.xml'" as="xs:string"/>
       </xsl:call-template>
@@ -594,7 +594,7 @@
   <xsl:template name="create_morpho">
     <xsl:param name="compoundID" as="xs:string"/>
     <xsl:param name="ann_segmentation.xml" as="document-node()"/>
-    <xsl:param name="ann_morphosyntax.xml" as="document-node()"/>
+    <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
     <xsl:param name="target" as="xs:string"/>
 
     <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
@@ -606,7 +606,7 @@
         
         <xsl:element name="spanList" namespace="{$KorAP_namespace}">
           <xsl:apply-templates select="$ann_segmentation.xml//tei:text" mode="morpho">
-            <xsl:with-param name="ann_morphosyntax.xml" select="$ann_morphosyntax.xml" as="document-node()" tunnel="yes"/>
+            <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()" tunnel="yes"/>
           </xsl:apply-templates>          
         </xsl:element>
       </xsl:element>
@@ -614,7 +614,7 @@
   </xsl:template>
 
   <xsl:template match="tei:seg" mode="morpho">
-    <xsl:param name="ann_morphosyntax.xml" as="document-node()" tunnel="yes"/>
+    <xsl:param name="ann_morphosyntax.doc" as="document-node()" tunnel="yes"/>
     <!-- it's so spread out because I wanted to make sure to be able to look up the individual 
       constituent values, should anything go wrong; it might get compacted at some point, but 
       the increase in efficiency will probably be minimal, compared to the decrease of readability   -->
@@ -623,7 +623,7 @@
     </xsl:variable>
     <xsl:variable name="my_name" select="local-name()" as="xs:string"/>
     <xsl:variable name="my_id" select="@xml:id" as="xs:string"/>
-    <xsl:variable name="my_morph-seg" as="node()" select="$ann_morphosyntax.xml//tei:seg[substring-after(@corresp,'#') eq $my_id]"/>
+    <xsl:variable name="my_morph-seg" as="node()" select="$ann_morphosyntax.doc//tei:seg[substring-after(@corresp,'#') eq $my_id]"/>
     <xsl:variable name="my_disamb" select="$my_morph-seg//tei:fs/tei:f[@name eq 'disamb']" as="node()"/>
     <xsl:variable name="my_choice-id" select="substring-after($my_disamb//tei:f[@name eq 'choice']/@fVal,'#')" as="xs:string"/>
     <xsl:variable name="my_choice-lex" select="$my_morph-seg//tei:f[@name eq 'interps']/tei:fs[@type eq 'lex'][descendant::tei:symbol[@xml:id eq $my_choice-id]]" as="node()"/>
@@ -671,8 +671,8 @@
   
   <xsl:template name="create_named">
     <xsl:param name="compoundID" as="xs:string"/>
-    <xsl:param name="ann_morphosyntax.xml" as="document-node()"/>
-    <xsl:param name="ann_named.xml" as="document-node()"/>
+    <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
+    <xsl:param name="ann_named.doc" as="document-node()"/>
     <xsl:param name="target" as="xs:string"/>
     <xsl:param name="rev_lookup" as="map(*)"/>
 
@@ -684,8 +684,8 @@
         <xsl:attribute name="version" select="$KorAP-XML_version"/>
         
         <xsl:element name="spanList" namespace="{$KorAP_namespace}">
-          <xsl:apply-templates select="$ann_morphosyntax.xml//tei:text" mode="named">
-            <xsl:with-param name="ann_named.xml" select="$ann_named.xml" as="document-node()" tunnel="yes"/>
+          <xsl:apply-templates select="$ann_morphosyntax.doc//tei:text" mode="named">
+            <xsl:with-param name="ann_named.doc" select="$ann_named.doc" as="document-node()" tunnel="yes"/>
             <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)" tunnel="yes"/>
           </xsl:apply-templates>          
         </xsl:element>
@@ -696,7 +696,7 @@
   <xsl:template match="tei:seg" mode="named"/>
   
   <xsl:template match="tei:seg[tei:fs[tei:f[@name eq 'disamb']]]" mode="named">
-    <xsl:param name="ann_named.xml" as="document-node()" tunnel="yes"/>
+    <xsl:param name="ann_named.doc" as="document-node()" tunnel="yes"/>
     <xsl:param name="rev_lookup" as="map(*)" tunnel="yes"/>
 
     <xsl:variable name="offsets" as="xs:integer+">
@@ -757,9 +757,9 @@
   <xsl:template name="create_groups">
     <xsl:param name="compoundID" as="xs:string"/>
     <xsl:param name="ann_segmentation.xml" as="document-node()"/>
-    <xsl:param name="ann_morphosyntax.xml" as="document-node()"/>
-    <xsl:param name="ann_words.xml" as="document-node()"/>
-    <xsl:param name="ann_groups.xml" as="document-node()"/>
+    <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
+    <xsl:param name="ann_words.doc" as="document-node()"/>
+    <xsl:param name="ann_groups.doc" as="document-node()"/>
     <xsl:param name="target" as="xs:string"/>
     
     <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
@@ -771,9 +771,9 @@
         
         <xsl:element name="spanList" namespace="{$KorAP_namespace}">
           <!--<xsl:apply-templates select="$ann_segmentation.xml//tei:text" mode="groups">
-            <xsl:with-param name="ann_morphosyntax.xml" select="$ann_morphosyntax.xml" as="document-node()" tunnel="yes"/>
-            <xsl:with-param name="ann_words.xml" select="$ann_words.xml" as="document-node()" tunnel="yes"/>
-            <xsl:with-param name="ann_groups.xml" select="$ann_groups.xml" as="document-node()" tunnel="yes"/>
+            <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()" tunnel="yes"/>
+            <xsl:with-param name="ann_words.doc" select="$ann_words.doc" as="document-node()" tunnel="yes"/>
+            <xsl:with-param name="ann_groups.doc" select="$ann_groups.doc" as="document-node()" tunnel="yes"/>
           </xsl:apply-templates>-->          
         </xsl:element>
       </xsl:element>
@@ -783,7 +783,7 @@
   <!--   **************************        TEXT header      *******************                -->
 
   <xsl:template name="create_text_header">
-    <xsl:param name="text.xml" as="document-node()"/>
+    <xsl:param name="text.doc" as="document-node()"/>
     <xsl:param name="compoundID" as="xs:string"/>
     <xsl:param name="target" as="xs:string"/>
 
@@ -792,7 +792,7 @@
       xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
 
       <idsHeader type="document" pattern="text" status="new" version="1.1" TEIform="teiHeader">
-        <xsl:apply-templates select="$text.xml//tei:TEI/tei:teiHeader/tei:*" mode="text">
+        <xsl:apply-templates select="$text.doc//tei:TEI/tei:teiHeader/tei:*" mode="text">
           <xsl:with-param name="compoundID" as="xs:string" select="$compoundID" tunnel="yes"/>
         </xsl:apply-templates>
       </idsHeader>