handle cases where no NE information is present in an NKJP NE document (don't produce named.xml then)
Change-Id: Id144588151b907055d6337fcc3e667f2748403fd
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
index d8a4603..86988ef 100644
--- a/nkjp2korap.xsl
+++ b/nkjp2korap.xsl
@@ -280,6 +280,8 @@
<xsl:when test="$my_textID = $IDs_to_skip"/>
<!-- this is a utility step, for when we want to ignore some texts for any reason (debugging, selective update) -->
<xsl:otherwise>
+
+ <xsl:message select="'Processing ' || $my_textID"/>
<xsl:call-template name="process_single_sample">
<xsl:with-param name="text.doc" as="document-node()" select="."/>
@@ -345,7 +347,7 @@
</xsl:call-template>
<xsl:if test="$ann_named.doc">
- <xsl:variable name="rev_lookup-seq" as="map(*)+">
+ <xsl:variable name="rev_lookup-seq" as="map(*)*">
<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).
@@ -360,16 +362,18 @@
</xsl:for-each>
</xsl:variable>
<xsl:variable name="rev_lookup" as="map(*)"
- select="map:merge($rev_lookup-seq, map {'duplicates': 'combine'})"/>
+ select="if(count($rev_lookup-seq)) then map:merge($rev_lookup-seq, map {'duplicates': 'combine'}) else map{}"/>
- <xsl:call-template name="create_named">
- <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
- <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
- as="document-node()"/>
- <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 test="map:size($rev_lookup)">
+ <xsl:call-template name="create_named">
+ <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
+ <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
+ as="document-node()"/>
+ <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>
<!-- <xsl:if test="$ann_words.doc and $ann_groups.doc">