<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2009  <NAME>.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/1999/xhtml">
  <xsl:output
      method="html"
      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
      indent="yes"
      media-type="application/xhtml+xml"
        />

  <xsl:template name="CssStylesheet">
    <style type="text/css">
      body {
      font-family: Verdana, sans-serif;
      white-space: nowrap;
      font-size: small;
      }
      .numeric {
      text-align: right;
      }
      table {
      border: 1px solid;
      border-collapse: collapse;
      }
      td, th {
      border-left: 1px solid;
      border-right: 1px solid;
      }
      pre {
      margin: 0px;
      padding: 0px;
      }
    </style>
  </xsl:template>

  <xsl:template match="/ProffyResults">
    <html>
      <head>
        <title>Proffy Results</title>
        <xsl:call-template name="CssStylesheet"/>
      </head>
      <body>
        <h1>Hello</h1>
        <xsl:apply-templates select="PointsEncountered"/>
      </body>
    </html>
  </xsl:template>

  <!--<xsl:template name="proffyInclusive">
    <xsl:param name="symbol"/>
    <xsl:param name="filename"/>
    <xsl:param name="linenumber"/>
    <xsl:param name="result"/>
    <xsl:param name="startid" select="0"/>
    
    <xsl:for-each select="/ProffyResults/PointsEncountered/Point[@Id >= $startid and @SymbolName = $mysymbol and @FileName = $filename and @LineNumber = $linenumber]">
      <xsl:variable name="myid" select="@Id"/>
      <xsl:value-of select="sum(/ProffyResults/CallCounters/Counter[@CallerId = $myid]@Count) + proffy:Inclusive($symbol, $filename, $linenumber, $myid+1)"/>
    </xsl:for-each>
    <xsl:value-of select="$result"/>
  </xsl:function>-->
  
  <xsl:template match="PointsEncountered">
      <xsl:for-each select="Point">
          <xsl:variable name="mysymbol" select="@SymbolName"/>
          <xsl:if test="count(preceding-sibling::node()[@SymbolName = $mysymbol]) = 0">
            <h2><xsl:value-of select="@SymbolName"/></h2>
            <!--<xsl:for-each select="../Point[@SymbolName = $mysymbol]">
              <xsl:value-of select="@Id"/>,  
            </xsl:for-each>-->
            <xsl:for-each select="/ProffyResults/Files/File">
              <xsl:variable name="filename" select="@Name"/>
              <xsl:if test="count(/ProffyResults/PointsEncountered/Point[@FileName = $filename and @SymbolName = $mysymbol]) > 0">
                <h3><xsl:value-of select="@Name"/></h3>
                <table>
                  <xsl:for-each select="Line">
                    <xsl:variable name="linenumber" select="@Number"/>
                    <xsl:if test="count(/ProffyResults/PointsEncountered/Point[@SymbolName = $mysymbol and @FileName = $filename and ((@LineNumber - $linenumber) &lt;= 3 and (@LineNumber - $linenumber) >= -3)]) > 0">
                      <tr>
                        <td>
                          <xsl:value-of select="@Number"/>
                        </td>
                        <!--<td>
                          <xsl:value-of select="proffy:Inclusive($mysymbol, $filename, $linenumber)"/>
                        </td>-->
                        <td>
                          <pre><xsl:value-of select="."/></pre><commit_msg>Finished XSLT for improved caller / callee information.<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2009  <NAME>.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/1999/xhtml">
  <xsl:output
      method="html"
      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
      indent="yes"
      media-type="application/xhtml+xml"
        />

  <xsl:template name="CssStylesheet">
    <style type="text/css">
      body {
      font-family: Verdana, sans-serif;
      white-space: nowrap;
      font-size: small;
      }
      .numeric {
      text-align: right;
      }
      table {
      border: 1px solid;
      border-collapse: collapse;
      }
      td, th {
      border-left: 1px solid;
      border-right: 1px solid;
      }
      pre {
      margin: 0px;
      padding: 0px;
      }
    </style>
  </xsl:template>

  <xsl:template match="/ProffyResults">
    <html>
      <head>
        <title>Proffy Results</title>
        <xsl:call-template name="CssStylesheet"/>
      </head>
      <body>
        <h1>Hello</h1>
        <xsl:apply-templates select="PointsEncountered"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="Counter" name="CallerCounters">
      <xsl:param name="symbol"/>
      <xsl:param name="filename"/>
      <xsl:param name="linenumber"/>
      <xsl:param name="docallers" select="0"/>
      <xsl:param name="docallees" select="0"/>

    <xsl:if test="$docallers = 1">
        <xsl:variable name="calleeid" select="@CalleeId"/>

        <xsl:if test="count(/ProffyResults/PointsEncountered/Point[@Id = $calleeid and @SymbolName = $symbol and @FileName = $filename and @LineNumber = $linenumber]) > 0">
            <a><xsl:attribute name="href">#<xsl:value-of select="@CallerId"/></xsl:attribute><xsl:value-of select="@CallerId"/>:<xsl:value-of select="@Count"/></a><br/>
        </xsl:if>
    </xsl:if>

    <xsl:if test="$docallees = 1">
        <xsl:variable name="callerid" select="@CallerId"/>

        <xsl:if test="count(/ProffyResults/PointsEncountered/Point[@Id = $callerid and @SymbolName = $symbol and @FileName = $filename and @LineNumber = $linenumber]) > 0">
            <a><xsl:attribute name="href">#<xsl:value-of select="@CalleeId"/></xsl:attribute><xsl:value-of select="@CalleeId"/>:<xsl:value-of select="@Count"/></a><br/>
        </xsl:if>
    </xsl:if>
  </xsl:template>

  <xsl:template match="Point">
      <xsl:param name="symbol"/>
      <xsl:param name="filename"/>
      <xsl:param name="linenumber"/>
        <xsl:if test="@SymbolName = $symbol and @FileName = $filename and @LineNumber = $linenumber">
            <a><xsl:attribute name="name"><xsl:value-of select="@Id"/></xsl:attribute></a>
        </xsl:if>
  </xsl:template>

  <xsl:template match="PointsEncountered">
      <xsl:for-each select="Point">
          <xsl:variable name="mysymbol" select="@SymbolName"/>
          <xsl:if test="count(preceding-sibling::node()[@SymbolName = $mysymbol]) = 0">
            <h2><xsl:value-of select="@SymbolName"/></h2>
            <!--<xsl:for-each select="../Point[@SymbolName = $mysymbol]">
              <xsl:value-of select="@Id"/>,  
            </xsl:for-each>-->
            <xsl:for-each select="/ProffyResults/Files/File">
              <xsl:variable name="filename" select="@Name"/>
              <xsl:if test="count(/ProffyResults/PointsEncountered/Point[@FileName = $filename and @SymbolName = $mysymbol]) > 0">
                <h3><xsl:value-of select="@Name"/></h3>
                <table>
                    <tr><th>Line Number</th><th>Callers</th><th>Callees</th><th>Code</th></tr>
                  <xsl:for-each select="Line">
                    <xsl:variable name="linenumber" select="@Number"/>
                    <xsl:if test="count(/ProffyResults/PointsEncountered/Point[@SymbolName = $mysymbol and @FileName = $filename and ((@LineNumber - $linenumber) &lt;= 3 and (@LineNumber - $linenumber) >= -3)]) > 0">
                      <tr>
                        <td>
                            <xsl:apply-templates select="/ProffyResults/PointsEncountered/Point">
                                <xsl:with-param name="symbol" select="$mysymbol"/>
                                <xsl:with-param name="filename" select="$filename"/>
                                <xsl:with-param name="linenumber" select="$linenumber"/>
                            </xsl:apply-templates>
                            <xsl:value-of select="@Number"/>
                        </td>
                        <td>
                            <xsl:apply-templates select="/ProffyResults/CallCounters/Counter">
                                <xsl:with-param name="symbol" select="$mysymbol"/>
                                <xsl:with-param name="filename" select="$filename"/>
                                <xsl:with-param name="linenumber" select="$linenumber"/>
                                <xsl:with-param name="docallers" select="1"/>
                            </xsl:apply-templates>
                        </td>
                        <td>
                            <xsl:apply-templates select="/ProffyResults/CallCounters/Counter">
                                <xsl:with-param name="symbol" select="$mysymbol"/>
                                <xsl:with-param name="filename" select="$filename"/>
                                <xsl:with-param name="linenumber" select="$linenumber"/>
                                <xsl:with-param name="docallees" select="1"/>
                            </xsl:apply-templates>
                        </td>
                        <td>
                          <pre><xsl:value-of select="."/></pre>
{'fraction_non_alphanumeric': 0.1563536435136928, 'fraction_numerical': 0.008907419691083104, 'mean_word_length': 2.1438784629133156, 'pattern_counts': {'":': 0, '<': 202, '<?xml version=': 2, '>': 211, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 8}, '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': '7450671', 'n_tokens_mistral': 3358, 'n_tokens_neox': 3097, 'n_words': 656}