<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all">
  
<!-- Assigns (and rewrites) IDs on certain elements in JATS/BITS, according to a certain logic.
     Please extend or replace to meet local requirements! You could:
     
     Change where IDs are assigned (to a different set of elements or not overriding @id values
       already present, for example)
     
     Change how ID strings are generated
     
     
  -->
  
  <xsl:template match="node() | @*">
    <xsl:copy>
       <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
  </xsl:template>

  <!-- Any IDREFS attributes must also mapped. -->
  <xsl:template match="@rid | @headers | @glyph-data">
    <xsl:attribute name="rid" separator=" ">
      <xsl:apply-templates mode="id" select="key('element-by-id',tokenize(.,'\s+'))"/>
    </xsl:attribute>
  </xsl:template>
  
  <!-- It should go without saying that we need to be able to retrieve elements by their
       old IDs if we are going to rewrite references to them! -->
  <xsl:key name="element-by-id" match="*[exists(@id)]" use="@id"/>
  
  <!-- Match any element for which IDs should be auto-assigned.
       Existing IDs are overwritten. -->
  <xsl:template match="*[exists(@id)] |
    book-part | sec | fig | table-wrap | boxed-text | chem-struct-wrap | fig | disp-formula">
    <!-- No op inside 'refactoring' <xsl:message>
      <xsl:value-of select="name()"/>
      <xsl:for-each select="@id">[@id='<xsl:value-of select="."/>']</xsl:for-each>
      <xsl:text> now has @id '</xsl:text>
      <xsl:value-of select="jatskit:id(.)"/>
      <xsl:text>'</xsl:text>
    </xsl:message>-->
    <xsl:copy>
      <xsl:apply-templates select="@* except @id"/>
      <xsl:attribute name="id">
        <xsl:apply-templates mode="id" select="."/>
      </xsl:attribute><commit_msg>Touchup for continuing lists<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all">
  
<!-- Assigns (and rewrites) IDs on certain elements in JATS/BITS, according to a certain logic.
     Please extend or replace to meet local requirements! You could:
     
     Change where IDs are assigned (to a different set of elements or not overriding @id values
       already present, for example)
     
     Change how ID strings are generated
     
     
  -->
  
  <xsl:template match="node() | @*">
    <xsl:copy>
       <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
  </xsl:template>

  <!-- Any IDREFS attributes must also mapped. -->
  <xsl:template match="@rid | @headers | @glyph-data | @continued-from | @xref">
    <xsl:attribute name="rid" separator=" ">
      <xsl:apply-templates mode="id" select="key('element-by-id',tokenize(.,'\s+'))"/>
    </xsl:attribute>
  </xsl:template>
  
  <!-- It should go without saying that we need to be able to retrieve elements by their
       old IDs if we are going to rewrite references to them! -->
  <xsl:key name="element-by-id" match="*[exists(@id)]" use="@id"/>
  
  <!-- Match any element for which IDs should be auto-assigned.
       Existing IDs are overwritten. -->
  <xsl:template match="*[exists(@id)] |
    book-part | sec | fig | table-wrap | boxed-text | chem-struct-wrap | fig | disp-formula">
    <!-- No op inside 'refactoring' <xsl:message>
      <xsl:value-of select="name()"/>
      <xsl:for-each select="@id">[@id='<xsl:value-of select="."/>']</xsl:for-each>
      <xsl:text> now has @id '</xsl:text>
      <xsl:value-of select="jatskit:id(.)"/>
      <xsl:text>'</xsl:text>
    </xsl:message>-->
    <xsl:copy>
      <xsl:apply-templates select="@* except @id"/>
      <xsl:attribute name="id">
        <xsl:apply-templates mode="id" select="."/>
      </xsl:attribute>
{'fraction_non_alphanumeric': 0.17845456833626983, 'fraction_numerical': 0.007550969041026932, 'mean_word_length': 3.1352757544224765, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 2, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5873014', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1268, 'n_words': 338}