I think it's done. Will clean it tomorrow and extend to morpho and beyond. My goodness.
Change-Id: Ib866ce501242d64b30a66ef881d2e23516fde430
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
index 62cb436..c001203 100644
--- a/nkjp2korap.xsl
+++ b/nkjp2korap.xsl
@@ -61,6 +61,9 @@
<xsl:variable name="OFFSET_START" as="xs:integer" static="yes" select="1"/>
<xsl:variable name="OFFSET_END" as="xs:integer" static="yes" select="2"/>
+ <xsl:variable name="INCOMPLETE_MAP" as="xs:integer" static="yes" select="-1"/>
+<!-- this is for travering the accumulator sequences, and skipping incomplete maps -->
+
<!-- MODES -->
@@ -69,30 +72,141 @@
<xsl:mode name="header-text" on-no-match="text-only-copy"/>
<xsl:mode use-accumulators="#all"/>
- <xsl:accumulator name="elem-offset-seq" as="map(xs:string, item()+)+" initial-value="(map{})">
- <xsl:accumulator-rule match="tei:w[parent::tei:seg[count(@nkjp:rejected) eq 0]]" phase="end">
- <xsl:variable name="previous_index" as="xs:integer">
- <xsl:choose>
- <xsl:when test="count($value) eq 1">
- <xsl:sequence select="0"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="grab_the_tip" as="map(*)" select="head(reverse($value))"/>
- <xsl:sequence select="map:get($grab_the_tip,map:keys($grab_the_tip)[1])[2]"/>
- <xsl:message select="'previous element:' || map:keys($grab_the_tip)[1]"></xsl:message>
- </xsl:otherwise>
- </xsl:choose>
+ <!--<xsl:function name="f:grab_the_tail" as="map(*)">
+ <xsl:param name="seq" as="map(*)+"/>
+ <xsl:choose>
+ <xsl:when test="map:get(head($seq),map:keys(head($seq))[1])[2] eq $INCOMPLETE_MAP">
+ <xsl:sequence select="f:grab_the_tail(tail($seq))"/>
+ <xsl:message select="'skip ' || map:keys(head($seq))[1]"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:sequence select="$seq"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:function>-->
+
+ <xsl:accumulator name="elem-offset-seq" as="map(xs:string, item()+)+" initial-value="(map{'null':(0,0)})">
+
+ <xsl:accumulator-rule match="tei:body/tei:p" phase="start">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
+ <xsl:message select="local-name() || ' below ' || parent::node()/@xml:id ||' start, previous element: ' || map:keys($the_tail)[1]"></xsl:message>
</xsl:variable>
- <xsl:variable name="our_base" as="xs:integer" select="$previous_index + xs:integer(f:is_preceded_by_ws(parent::tei:seg))"/>
- <xsl:message select="'previous_index:' || $previous_index || 'our_base: ' || $our_base"/>
+ <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + 1"/>
+ <!-- for paragraphs, it's in either being initial or not -->
+ <xsl:message select="@xml:id || ' start, preceding_index: ' || $preceding_index || ', our_base: ' || $our_base"/>
+
+ <xsl:sequence select="
+ $value,
+ map {
+ string(@xml:id): ($preceding_index,$our_base)
+ }"/>
+ </xsl:accumulator-rule>
+
+ <xsl:accumulator-rule match="tei:s" phase="start">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
+ <xsl:message select="'s start, previous element: ' || map:keys($the_tail)[1]"></xsl:message>
+ </xsl:variable>
+
+ <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + + xs:integer(f:is_preceded_by_ws(.,true()))"/>
+ <xsl:message select="@xml:id || ' start, preceding_index: ' || $preceding_index || ', our_base: ' || $our_base"/>
+
+ <xsl:sequence select="
+ $value,
+ map {
+ string(@xml:id): ($preceding_index,$our_base)
+ }"/>
+ </xsl:accumulator-rule>
+
+ <xsl:accumulator-rule match="tei:w[parent::tei:seg[count(@nkjp:rejected) eq 0]]" phase="end">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
+ <xsl:message select="'w, previous element: ' || map:keys($the_tail)[1]"></xsl:message>
+ </xsl:variable>
+ <xsl:variable name="our_base" as="xs:integer" select="$preceding_index + xs:integer(f:is_preceded_by_ws(parent::tei:seg,true()))"/>
+
+ <xsl:message select="'w, preceding_index: ' || $preceding_index || ', our_base: ' || $our_base"/>
+ <!--<xsl:message select="('VALUE at w-end:',serialize($value, map{'method':'adaptive'}))"/>-->
<xsl:sequence select="
$value,
map {
string(parent::tei:seg/@xml:id): ($our_base,$our_base + string-length())
}"/>
</xsl:accumulator-rule>
+
+ <xsl:accumulator-rule match="tei:s" phase="end">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
+
+ <!--<xsl:message select="('VALUE at s-end:',serialize($value, map{'method':'adaptive'}))"/>-->
+
+ </xsl:variable>
+ <xsl:variable name="our_base" as="xs:integer">
+ <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
+ <xsl:sequence select="$incomplete[2]"/>
+ </xsl:variable>
+
+ <xsl:message select="'s end, preceding_index: ' || $preceding_index || ', our_base: ' || $our_base"/>
+
+ <xsl:sequence select="
+ $value,
+ map {
+ string(@xml:id): ($our_base,$preceding_index)
+ }"/>
+ </xsl:accumulator-rule>
+
+ <xsl:accumulator-rule match="tei:body/tei:p" phase="end">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
+
+ <!--<xsl:message select="('VALUE at p-end:',serialize($value, map{'method':'adaptive'}))"/>-->
+
+ </xsl:variable>
+ <xsl:variable name="our_base" as="xs:integer">
+ <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
+ <xsl:sequence select="$incomplete[2]"/>
+ </xsl:variable>
+
+ <xsl:message select="'p end, preceding_index: ' || $preceding_index || ', our_base: ' || $our_base"/>
+
+ <xsl:sequence select="
+ $value,
+ map {
+ string(@xml:id): ($our_base,$preceding_index)
+ }"/>
+ </xsl:accumulator-rule>
+
+ <xsl:accumulator-rule match="tei:body" phase="end">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail, map:keys($the_tail)[1])[2]"/>
+ </xsl:variable>
+
+ <xsl:sequence select="
+ $value,
+ map {
+ string(@xml:id): (0, $preceding_index)
+ }"/>
+ </xsl:accumulator-rule>
+
+ <xsl:accumulator-rule match="tei:text" phase="end">
+ <xsl:variable name="preceding_index" as="xs:integer">
+ <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
+ <xsl:sequence select="map:get($the_tail, map:keys($the_tail)[1])[2]"/>
+ </xsl:variable>
+
+ <xsl:sequence select="
+ $value,
+ map {
+ string(@xml:id): (0, $preceding_index)
+ }"/>
+ </xsl:accumulator-rule>
</xsl:accumulator>
@@ -108,22 +222,35 @@
<xsl:function name="f:is_preceded_by_ws" as="xs:boolean">
<xsl:param name="node" as="element()"/>
+ <xsl:param name="suppress_initial" as="xs:boolean"/>
<xsl:choose>
- <xsl:when test="local-name($node) eq 'seg'">
- <xsl:sequence
+ <xsl:when test="local-name($node) eq 'seg'">
+ <xsl:choose>
+ <xsl:when test="$node/@nkjp:nps"><xsl:sequence select="fn:false()"/></xsl:when>
+ <xsl:otherwise>
+ <xsl:sequence
+ select="not($suppress_initial) and not($node[count(preceding-sibling::tei:seg) eq 0]/ancestor::tei:s[count(preceding-sibling::tei:s) eq 0]/ancestor::tei:p[count(preceding-sibling::tei:p) eq 0])"
+ />
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!--<xsl:sequence
select="not(exists($node/@nkjp:nps)) and not($node[count(preceding-sibling::tei:seg) eq 0]/ancestor::tei:s[count(preceding-sibling::tei:s) eq 0]/ancestor::tei:p[count(preceding-sibling::tei:p) eq 0])"
- />
+ />-->
<!--and not($node/ancestor::tei:s[count(preceding-sibling::tei:s) eq 0]/ancestor::tei:p[count(preceding-sibling::tei:p) eq 0])-->
</xsl:when>
<xsl:when test="local-name($node) eq 's'">
- <xsl:message select="'s - prec s: ' || $node/preceding-sibling::tei:s"/>
- <xsl:message select="'same s - prec p: ' || $node/ancestor::tei:p[1]/preceding-sibling::tei:p || ' '"/>
+ <xsl:choose>
+ <xsl:when test="exists($node/preceding-sibling::tei:s)"><xsl:sequence select="fn:true()"/></xsl:when>
+ <xsl:otherwise>
+ <xsl:message select="'. s indented: ' || xs:string(not($suppress_initial) and exists($node/ancestor::tei:p[1]/preceding-sibling::tei:p))"></xsl:message>
+ <xsl:sequence select="not($suppress_initial) and exists($node/ancestor::tei:p[1]/preceding-sibling::tei:p)"/>
+ </xsl:otherwise>
+ </xsl:choose>
- <xsl:sequence select="exists($node/preceding-sibling::tei:s) or exists($node/ancestor::tei:p[1]/preceding-sibling::tei:p)"/>
</xsl:when>
<xsl:when test="local-name($node) eq 'p'">
- <xsl:message select="'p : ' || $node/preceding-sibling::tei:p"></xsl:message>
<xsl:sequence select="exists($node/preceding-sibling::tei:p)"/>
</xsl:when>
<xsl:otherwise>
@@ -140,18 +267,9 @@
<xsl:template match="tei:w" mode="#all"/>
<!-- NKJP-SGJP has apparently resigned from standoff representations by adding <w> everywhere;
- for the time being, we'll just stick to the standoff offsets, although that may need to
- be revisited as the NKJP format has now began to stray from its schemas and assumptions -->
+ we reach for them, but from the level of <seg>, so we don't need to process <w> separately -->
- <!--<xsl:template match="tei:choice" mode="#all"/>-->
-<!-- THIS IS ONLY TEMPORARY,
- because an interesting challenge came up where I will
- probably have to abandon straightforward mapping because of TOKENIZATION alternatives;
-
- but now, I just want this stylesheet to work, even if it eats some occasional token (which it now does, 'komuĊ' and 'czym' vanish)
- -->
-
- <!--fall-thru-->
+ <!--fall-thru, skipping the potential <paren> element -->
<xsl:template match="tei:choice" mode="struct">
<xsl:apply-templates select="descendant::tei:seg"/>
</xsl:template>
@@ -178,14 +296,8 @@
<xsl:choose>
<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="f:calc_offsets(doc($ann_segmentation.uri)//tei:body/tei:p[1]/tei:s[2]/tei:seg[1],false())"/>-->
-
-<!-- <xsl:message select="doc($ann_segmentation.uri)//tei:body/tei:p[1]/tei:s[1]/tei:seg[1] || f:is_preceded_by_ws(doc($ann_segmentation.uri)//tei:body/tei:p[1]/tei:s[1]/tei:seg[1])"/>
- <xsl:message select="doc($ann_segmentation.uri)//tei:body/tei:p[1]/tei:s[1]/tei:seg[3] || f:is_preceded_by_ws(doc($ann_segmentation.uri)//tei:body/tei:p[1]/tei:s[1]/tei:seg[3])"/>
--->
<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()"
@@ -212,117 +324,6 @@
select="$corpusID || '_' || $docID || '.' || $my_textID"/>
<!-- this is what occurs in the text and data layers as @docid -->
-<!-- this is space devoted to recalculating word offsets on the basis of ann_segmentation.xml (rather than text.xml).
- The results should be available to all annotation files, so we prepare a map here and send it off to whichever
- annotation layer needs it. -->
-
-<!-- This is done is several steps, because I wanted to be able to look stuff up. There should probably be some
- idiomatic way to reduce the memory footprint of these variables - I'll be happy to learn about it. -->
-
- <!--<xsl:variable name="map_w" as="map(xs:untypedAtomic,item()+)">
- <xsl:variable name="segs" select="$ann_segmentation.xml/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s//tei:seg[count(@nkjp:rejected) eq 0]" as="element()+"/>
- <xsl:map>
- <xsl:for-each-group select="$segs" group-by="ancestor::tei:p[1]/@xml:id">
- <xsl:variable name="current-p" select="current-grouping-key()"/>
- <xsl:for-each-group select="current-group()" group-by="ancestor::tei:s[1]/@xml:id">
- <xsl:variable name="current-s" select="current-grouping-key()"/>
- <xsl:for-each select="current-group()">
- <xsl:map-entry key="@xml:id" select="$current-p, $current-s, position(), f:is_preceded_by_ws(.), normalize-space(tei:w)"/>
- </xsl:for-each>
- </xsl:for-each-group>
- </xsl:for-each-group>
- </xsl:map>
- </xsl:variable>-->
-
- <!--<xsl:variable name="map_p-s-w" as="map(xs:untypedAtomic,item()+)">
- <xsl:map>
- <xsl:for-each-group select="map:keys($map_w)" group-by="map:get($map_w, .)[1]">
- <xsl:sort select="xs:integer(substring-before(substring-after(., 'segm_'), '.'))"
- order="ascending"/>
- <xsl:sort select="xs:integer(substring-before(substring-after(., '.'), '-'))"
- order="ascending"/>
- <xsl:variable name="current-p-pos" select="fn:position()" as="xs:integer"/>
- <!-\- the above is used in the sentence loop, when we check if it's text-initial -\->
- <xsl:variable name="current-p" select="fn:current-grouping-key()" as="xs:string"/> <!-\-xs:untypedAtomic-\->
- <xsl:variable name="p-length" select="
- sum(for $id in current-group()
- return
- string-length(map:get($map_w, $id)[5])) + count(current-group()) - xs:integer(position() ne 1) -
- count(fn:filter(current-group(), function ($w-id) {
- map:get($map_w, $w-id)[4] eq false()
- }))"/>
- <!-\- The general algorithm is:
- * count and sum the lengths of all the words
- * add 'whitespace' for all of them (= count them and add that), and then
- * subtract whitespace for those of them that are not actually preceded by it
- and if the 1st word is_preceded_by_ws then subtract 1
- because identifying that 1st word would require an extra step, we're taking a shortcut via position() -
- and that strongly depends on the presence of the xsl:sort instructions -\->
-
- <xsl:message select="'sum: ' || sum( for $id in current-group() return string-length(map:get($map_w, $id)[5]) )"/>
- <!-\-<xsl:message select="for $id in current-group() return (string-length(map:get($map_w, $id)[5]),map:get($map_w, $id)[4] )"/>-\->
- <xsl:message select="'cur-group count: ' || count(fn:current-group())"/>
- <!-\-<xsl:message select="fn:for-each(current-group(), function($w-id) { map:get($map_w,$w-id)[4] eq false() } )"></xsl:message>-\->
- <xsl:message select="'subtract:' || count(fn:filter(current-group(), function($w-id) { map:get($map_w,$w-id)[4] eq false() } ))"></xsl:message>
- <xsl:message select="'position: ' || position() || ', xs:integer(position() ne 1)=' || xs:integer(position() ne 1)"></xsl:message>
- <xsl:message select="'p-length: ' || $p-length"/>
-
- <xsl:map-entry key="current-grouping-key()" select="'p', position(), $p-length"/>
-
- <xsl:message select="'p: ', $current-p || ' pos:' || position(), current-group()"/>
-
- <xsl:for-each-group select="current-group()" group-by="map:get($map_w, .)[2]">
- <xsl:sort select="xs:integer(substring-before(substring-after(., 'segm_'), '.'))"
- order="ascending"/>
- <xsl:sort select="xs:integer(substring-before(substring-after(., '.'), '-'))"
- order="ascending"/>
- <xsl:variable name="current-s" select="fn:current-grouping-key()" as="xs:string"/> <!-\-xs:untypedAtomic-\->
- <xsl:variable name="s-length" select="
- sum(for $id in current-group()
- return
- string-length(map:get($map_w, $id)[5])) + count(current-group()) - xs:integer($current-p-pos ne 1) -
- count(fn:filter(current-group(), function ($w-id) {
- map:get($map_w, $w-id)[4] eq false()
- }))"/>
-
-
- <xsl:map-entry key="current-grouping-key()" select="'s', position(), $s-length, $current-p"/>
-
- <xsl:message select="'s: ', position(), current-group()"/>
-
- <xsl:for-each select="current-group()">
- <xsl:sort select="map:get($map_w, .)[3]" order="ascending"/>
- <xsl:map-entry key="." select="'w', position(), string-length(map:get($map_w, .)[5]), $current-s, map:get($map_w, .)[4]"/>
- <!-\- <xsl:message select="map:get($map_w, .)[5]"/>-\->
- </xsl:for-each>
- </xsl:for-each-group>
- </xsl:for-each-group>
- </xsl:map>
- </xsl:variable>-->
-
- <!--<xsl:variable name="offsets-p" as="map(xs:untypedAtomic,item()+)">
- <xsl:map>
- <xsl:for-each select="
- fn:filter(map:keys($map_p-s-w), function ($ele) {
- map:get($map_p-s-w, $ele)[1] eq 'p'
- })">
- <xsl:sort select="map:get($map_p-s-w, .)[2]"/>
-
- <xsl:map-entry key="." select="map:get($map_p-s-w, .)[2]"/>
-
-
- </xsl:for-each>
- </xsl:map>
- </xsl:variable>-->
-
-
-
-
- <!-- <xsl:message select="'map_w size: ' || map:size($map_w)"/>
- <xsl:message select="'map_s-p size: ' || map:size($map_p-s-w)"/>
- <xsl:message select="'offsets size: ' || map:size($offsets-p)"/>-->
-
-
<xsl:call-template name="create_data">
<!--<xsl:with-param name="text.xml" select="$text.xml" as="document-node()"/>-->
<xsl:with-param name="ann_segmentation.xml" select="$ann_segmentation.xml" as="document-node()"/>
@@ -336,7 +337,6 @@
as="document-node()"/>
<xsl:with-param name="target" select="$targetBaseDir || '/struct/structure.xml'" as="xs:string"
/>
- <!--<xsl:with-param name="offsets" select="$offsets" as="map(xs:string, xs:integer+)"/>-->
</xsl:call-template>
<!-- <xsl:call-template name="create_morpho">
@@ -355,8 +355,6 @@
<xsl:with-param name="target" select="$targetBaseDir || '/header.xml'" as="xs:string"/>
</xsl:call-template>-->
- <!--<xsl:message select="'size of offsets in process_single: ' || map:size($offsets)"/>-->
-
</xsl:template>
<!-- ************************** data.xml ******************* -->
@@ -381,7 +379,7 @@
<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:sequence select="
- if (f:is_preceded_by_ws(.)) then
+ if (f:is_preceded_by_ws(.,false())) then
' '
else
'', ./tei:w"/>
@@ -399,7 +397,6 @@
<xsl:param name="compoundID" as="xs:string"/>
<xsl:param name="ann_segmentation.xml" as="document-node()"/>
<xsl:param name="target" as="xs:string"/>
- <!--<xsl:param name="offsets" as="map(xs:string, xs:integer+)"/>-->
<xsl:result-document encoding="UTF-8" method="xml" indent="yes"
xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
@@ -407,8 +404,6 @@
<xsl:element name="layer" namespace="{$KorAP_namespace}">
<xsl:attribute name="docid" select="$compoundID"/>
<xsl:attribute name="version" select="$KorAP-XML_version"/>
-
- <!--<xsl:message select="'size of offsets in create_struct: ' || map:size($offsets)"/>-->
<xsl:element name="spanList" namespace="{$KorAP_namespace}">
<xsl:apply-templates select="$ann_segmentation.xml//tei:text" mode="struct">
@@ -429,15 +424,10 @@
<xsl:param name="ini" as="xs:integer" required="no" select="0"/>
<xsl:param name="fin" as="xs:integer" required="no" select="999999999"/>
<xsl:param name="index" as="xs:integer" required="no" select="1"/>
- <!--<xsl:param name="offsets" as="map(xs:string, xs:integer+)" tunnel="yes"/>-->
<xsl:variable name="offsets" as="map(xs:string, xs:integer+)"
- select="map:merge(tail(fn:accumulator-after('elem-offset-seq')))"/>
+ select="map:merge(tail(fn:accumulator-after('elem-offset-seq')),map{'duplicates':'use-last'})"/>
-<!-- <xsl:message select="'size of offsets in tei:* ' || map:size($offsets)"/>-->
-
- <!-- It's so spread out because I want to make sure to be able to look up the individual
- constituent values, should anything go wrong; optimization will come when it's worked against a larger dataset -->
<xsl:variable name="my_name" select="local-name()" as="xs:string"/>
<xsl:variable name="preceding" select="preceding-sibling::*[local-name(.) eq $my_name]"/>
<xsl:variable name="preceding-count" select="count($preceding)"/>
@@ -465,9 +455,6 @@
<xsl:variable name="my_index" select="$index + 1 + $preceding-count + $outside-preceding-count"
as="xs:integer"/>
-
-
- <!--<xsl:copy select="//tei:seg[count(@nkjp:rejected) ne 0 and @nkjp:rejected ne 'true']"></xsl:copy>-->
<xsl:variable name="start" as="xs:integer">
<xsl:choose>
@@ -501,16 +488,14 @@
<xsl:variable name="end" as="xs:integer" select="f:calc_content_length(.)">
</xsl:variable>
-
-
<xsl:element name="span" namespace="{$KorAP_namespace}">
<xsl:attribute name="id" select="'s' || $my_index"/>
- <xsl:attribute name="from" select="$start"/>
- <xsl:attribute name="to" select="$end"/>
- <xsl:attribute name="accumulator" select="string-join(map:get($offsets,string(@xml:id)),',')"/> <!--test-->
+ <xsl:attribute name="from" select="map:get($offsets,string(@xml:id))[1]"/>
+ <xsl:attribute name="to" select="map:get($offsets,string(@xml:id))[2]"/>
+<!-- <xsl:attribute name="accumulator" select="string-join(map:get($offsets,string(@xml:id)),',')"/> <!-\-test-\->-->
<xsl:attribute name="l" select="f:compute_nesting(.)"/>
<xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
- <xsl:attribute name="type" select="'struct'"></xsl:attribute> <!-- STRUCT vs. LEX -->
+ <xsl:attribute name="type" select="'struct'"></xsl:attribute> <!-- STRUCT vs. LEX for morpho -->
<xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
<xsl:attribute name="name" select="'name'"/>
<xsl:value-of select="local-name()"/>
@@ -1137,4 +1122,4 @@
</xsl:stylesheet>
-<!--<xsl:message select="('map:',serialize($map, map{'method':'adaptive'}))"/>-->
\ No newline at end of file
+<!-- template for serializing maps in messages <xsl:message select="('map:',serialize($map, map{'method':'adaptive'}))"/> -->
\ No newline at end of file