<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:dbk="http://docbook.org/ns/docbook"
  xmlns:css="http://www.w3.org/1996/css" 
  xmlns:hub="http://transpect.io/hub"
  xmlns:mml="http://www.w3.org/1998/Math/MathML" 
  xmlns:tr="http://transpect.io"
  xmlns:docx2tex="http://transpect.io/docx2tex"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"   
  xmlns="http://docbook.org/ns/docbook"
  version="2.0" 
  exclude-result-prefixes="#all"
  xpath-default-namespace="http://docbook.org/ns/docbook">  

  <!--  *
        * MODE docx2tex-postprocess
        * -->
  
  <!-- tag \ref, \pageref and \label -->
  
  <xsl:variable name="anchor-ids" select="//anchor[@role eq 'start']/@xml:id" as="xs:string*"/>
  <xsl:variable name="anchor-digits" select="string-length(xs:string(count($anchor-ids)))" as="xs:integer"/>
  
  <xsl:template match="anchor[@role eq 'start']" mode="docx2tex-postprocess">
    <xsl:variable name="index" select="index-of($anchor-ids, @xml:id)" as="xs:integer?"/>
    <xsl:copy>
      <xsl:apply-templates select="@*, node()" mode="#current"/>
      <xsl:if test="$refs ne 'no' and exists($index)">
        <xsl:variable name="label" select="concat('ref-', string-join(for $i in (string-length(xs:string($index)) to $anchor-digits) return '0', ''), $index)" as="xs:string"/>
        <xsl:processing-instruction name="latex" select="concat('\label{', $label, '}')"/>
      </xsl:if>
    </xsl:copy>
  </xsl:template>
  <commit_msg>process anchors without role attribute<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:dbk="http://docbook.org/ns/docbook"
  xmlns:css="http://www.w3.org/1996/css" 
  xmlns:hub="http://transpect.io/hub"
  xmlns:mml="http://www.w3.org/1998/Math/MathML" 
  xmlns:tr="http://transpect.io"
  xmlns:docx2tex="http://transpect.io/docx2tex"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"   
  xmlns="http://docbook.org/ns/docbook"
  version="2.0" 
  exclude-result-prefixes="#all"
  xpath-default-namespace="http://docbook.org/ns/docbook">  

  <xsl:param name="refs" select="'yes'"/>

  <!--  *
        * MODE docx2tex-postprocess
        * -->
  
  <!-- tag \ref, \pageref and \label -->
  
  <xsl:variable name="anchor-ids" select="//anchor[@role eq 'start' or not(@role)]/@xml:id" as="xs:string*"/>
  <xsl:variable name="anchor-digits" select="string-length(xs:string(count($anchor-ids)))" as="xs:integer"/>
  
  <xsl:template match="anchor[@role eq 'start' or not(@role)]" mode="docx2tex-postprocess">
    <xsl:variable name="index" select="index-of($anchor-ids, @xml:id)" as="xs:integer?"/>
    <xsl:copy>
      <xsl:apply-templates select="@*, node()" mode="#current"/>
      <xsl:if test="$refs ne 'no' and exists($index)">
        <xsl:variable name="label" select="concat('ref-', string-join(for $i in (string-length(xs:string($index)) to $anchor-digits) return '0', ''), $index)" as="xs:string"/>
        <xsl:processing-instruction name="latex" select="concat('\label{', $label, '}')"/>
      </xsl:if>
    </xsl:copy>
  </xsl:template>
  
{'fraction_non_alphanumeric': 0.22822631913541006, 'fraction_numerical': 0.019071837253655435, 'mean_word_length': 4.142156862745098, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 2, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 24}, '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': '749150', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1155, 'n_words': 159}