<commit_before><xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
                xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
                xmlns:tei="http://www.tei-c.org/ns/1.0"
                xmlns:xi="http://www.w3.org/2001/XInclude"
                xmlns:kiln="http://www.kcl.ac.uk/artshums/depts/ddh/kiln/ns/1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!-- Transform a document that includes every template in the
       inheritance chain into a single template with the content
       merged up the chain. -->

  <xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="axsl" />

  <xsl:template match="/">
    <axsl:stylesheet exclude-result-prefixes="#all" version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:copy-of select="//xsl:import" />
      <xsl:copy-of select="//xsl:include" />
      <xsl:copy-of select="//kiln:root/xsl:param" />
      <xsl:copy-of select="//kiln:root/xsl:variable" />

      <axsl:template match="/">
        <xsl:apply-templates />
      </axsl:template>
    </axsl:stylesheet>
  </xsl:template>

  <xsl:template match="kiln:block">
    <!-- Process the leaf instance of this named block (ie, the
         definition closest to the template being rendered, and
         consequently the last with its name in the XML). -->
    <xsl:apply-templates mode="render"
      select="//kiln:block[@name=current()/@name][not(following::kiln:block[@name=current()/@name])]"
     /><commit_msg>Added fix for namespaces not being declared in generated template XSLT where there are no elements or attributes in that namespace, but where there are references to namespaced variables/functions, causing 'namespace not declared' errors.<commit_after><xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
                xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
                xmlns:xi="http://www.w3.org/2001/XInclude"
                xmlns:kiln="http://www.kcl.ac.uk/artshums/depts/ddh/kiln/ns/1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!-- Transform a document that includes every template in the
       inheritance chain into a single template with the content
       merged up the chain. -->

  <xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="axsl" />

  <xsl:template match="/">
    <axsl:stylesheet exclude-result-prefixes="#all" version="2.0"
                     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <!-- Ensure that all of the namespaces declared on the kiln:root
           are declared in the generated stylesheet. It is possible to
           have references to namespaced variables or functions,
           without any elements or attributes in that namespace (and
           with the same prefix), causing no namespace declaration to
           be added at an appropriate point. -->
      <xsl:variable name="root" select="kiln:root" />
      <xsl:for-each select="in-scope-prefixes($root)[not(. eq 'xml')]">
        <xsl:namespace name="{.}" select="namespace-uri-for-prefix(., $root)" />
      </xsl:for-each>
      <xsl:copy-of select="//xsl:import" />
      <xsl:copy-of select="//xsl:include" />
      <xsl:copy-of select="//kiln:root/xsl:param" />
      <xsl:copy-of select="//kiln:root/xsl:variable" />

      <axsl:template match="/">
        <xsl:apply-templates />
      </axsl:template>
    </axsl:stylesheet>
  </xsl:template>

  <xsl:template match="kiln:block">
    <!-- Process the leaf instance of this named block (ie, the
         definition closest to the template being rendered, and
         consequently the last with its name in the XML). -->
    <xsl:apply-templates mode="render"
      select="//kiln:block[@name=current()/@name][not(following::kiln:block[@name=current()/@name])]"
     />
{'fraction_non_alphanumeric': 0.15358451072736787, 'fraction_numerical': 0.0141287284144427, 'mean_word_length': 2.8499496475327293, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 11, 'xml': 12}, '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': '2273987', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1144, 'n_words': 265}