successfully switched to ann_morpho for data.xml

Change-Id: Idb0612349cee0e4382b1e439ecc5fda1ced79578
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
index 2f04231..37248ee 100644
--- a/nkjp2korap.xsl
+++ b/nkjp2korap.xsl
@@ -372,7 +372,7 @@
       <xsl:variable name="my_dir" as="xs:string" select="replace(base-uri(),'/text\.xml','')"/>
       <xsl:variable name="my_textID" as="xs:string" select="tokenize($my_dir,'/')[last()]"/>
       <xsl:variable name="ann_morphosyntax.uri" select="$my_dir || '/ann_morphosyntax.xml'" as="xs:string"/>
-      <xsl:variable name="ann_segmentation.uri" select="$my_dir || '/ann_segmentation.xml'" as="xs:string"/>
+      <!--<xsl:variable name="ann_segmentation.uri" select="$my_dir || '/ann_segmentation.xml'" as="xs:string"/>-->
       <xsl:variable name="ann_named.uri" select="$my_dir || '/ann_named.xml'" as="xs:string"/>
       <xsl:variable name="ann_groups.uri" select="$my_dir || '/ann_groups.xml'" as="xs:string"/>
       <xsl:variable name="ann_words.uri" select="$my_dir || '/ann_words.xml'" as="xs:string"/>
@@ -386,8 +386,8 @@
             <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="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.doc" as="document-node()*"
@@ -406,7 +406,7 @@
   <xsl:template name="process_single_sample">
     <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="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.doc" as="document-node()*"/>
@@ -420,29 +420,34 @@
     <!--  this is what occurs in the text and data layers as @docid -->
     
     <xsl:call-template name="create_data">
-      <xsl:with-param name="ann_segmentation.xml" select="$ann_segmentation.xml" as="document-node()"/>
+      <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()"/>
       <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
       <xsl:with-param name="target" select="$targetBaseDir ||  '/data.xml'" as="xs:string"/>
     </xsl:call-template>
 
-    <xsl:call-template name="create_struct">
+ <!--   <xsl:call-template name="create_struct">
       <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="target" select="$targetBaseDir ||  '/struct/structure.xml'" as="xs:string"
       />
-    </xsl:call-template>
+    </xsl:call-template>-->
     
-    <xsl:call-template name="create_morpho">
+<!--    <xsl:call-template name="create_morpho">
       <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.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>-->
 
-    <xsl:call-template name="create_text_header">
+<!--
+      
+      THESE ARE SAFE
+      
+      
+      <xsl:call-template name="create_text_header">
       <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"/>
@@ -453,8 +458,8 @@
           <xsl:for-each
             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 -->
+            <!-\- 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 -\->
 
             <xsl:if test="fn:string-length($trg) and $trg eq 'ann_morphosyntax.xml'">
             <xsl:sequence>
@@ -476,12 +481,10 @@
         <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)"/>
       </xsl:call-template>
     </xsl:if>
-
+-->
     <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.doc" select="$ann_morphosyntax.doc"
           as="document-node()"/>
         <xsl:with-param name="ann_words.doc" select="$ann_words.doc"
@@ -497,7 +500,7 @@
   <!--   **************************        data.xml       *******************                -->
 
   <xsl:template name="create_data">
-    <xsl:param name="ann_segmentation.xml" as="document-node()"/>
+    <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
     <xsl:param name="compoundID" as="xs:string"/>
     <xsl:param name="target" as="xs:string"/>
     <!-- create the data.xml file -->
@@ -513,12 +516,13 @@
 
         <xsl:element name="text" namespace="{$KorAP_namespace}">
           <xsl:variable name="content" as="xs:string+">
-            <xsl:for-each select="$ann_segmentation.xml/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s//tei:seg[count(@nkjp:rejected) eq 0]">
+            <!--<xsl:for-each select="$ann_morphosyntax.doc/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s//tei:seg[count(@nkjp:rejected) eq 0]">-->
+            <xsl:for-each select="$ann_morphosyntax.doc/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s/tei:seg[tei:fs/tei:f[@name eq 'disamb']]">
               <xsl:sequence select="
                   if (f:is_preceded_by_ws(.,false())) then
                     ' '
                   else
-                    '', ./tei:w"/>
+                  '', ./tei:fs/tei:f[@name eq 'orth']/tei:string"/>
             </xsl:for-each>
           </xsl:variable>
           <xsl:value-of select="string-join($content)"/>
@@ -756,7 +760,6 @@
   
   <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.doc" as="document-node()"/>
     <xsl:param name="ann_words.doc" as="document-node()"/>
     <xsl:param name="ann_groups.doc" as="document-node()"/>