<commit_before><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:ino="http://namespaces.softwareag.com/tamino/response2"
	xmlns:xql="http://metalab.unc.edu/xql/"
	xmlns:cti="http://cti.library.emory.edu/"
	version="1.0">

  <!-- summary mode:
       brief display of series & subseries (hits if keyword search)
       -->

  <xsl:template match="dsc/head" mode="summary">
    <h2><xsl:value-of select="text()"/></h2>		
  </xsl:template>
	
  <xsl:template match="c01|c02|c03" mode="summary">
    <p>
      <h4>
        <!--        <xsl:attribute name="class"><xsl:value-of select="local-name()"/></xsl:attribute> -->
        <xsl:element name="a">
          <xsl:attribute name="href">content.php?el=<xsl:value-of select="local-name()"/>&amp;id=<xsl:value-of select="self::node()/@id"/><xsl:value-of select="$url_suffix"/></xsl:attribute>			
          <xsl:value-of select="did/unitid"/>
          <xsl:text>: &#x00A0;</xsl:text>
          <xsl:value-of select="did/unittitle"/>
        </xsl:element>

        <!-- note: hits are *inside* h4 to keep them on the same line -->      

        <!-- if we have the full-text, count matches under this node -->
        <xsl:variable name="count"><xsl:value-of select="count(.//exist:match)"/> </xsl:variable>

      <xsl:choose>
        <xsl:when test="$count > 0">
          <span class="hits"><xsl:value-of select="$count"/> hit<xsl:if test="$count > 1">s</xsl:if></span>
        </xsl:when>
        <!-- if not full-text, use results from exist match-count -->
        <xsl:when test="local-name() != 'c01' and hits > 0">
        <!-- FIXME : temporary fix because of a bug in eXist's match-count; 
               correctly detects hits / no hits in subseries, but count is inaccurate. -->
          <span class="hits">hits</span>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="hits"/>
        </xsl:otherwise>
      </xsl:choose>

      </h4>            

    </p>
    <!-- if there are subseries, indent to display hierarchy -->
    <xsl:if test="count(c02[@level='subseries']) + count(c03[@level='subseries']) > 0">
      <ul>
        <xsl:apply-templates select="c02[@level='subseries']|c03[@level='subseries']" mode="summary"/>
      </ul>
    </xsl:if>
  </xsl:template>

	
</xsl:stylesheet>
<commit_msg>cleaned up xsl based on marblpdf<commit_after><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:ino="http://namespaces.softwareag.com/tamino/response2"
	xmlns:xql="http://metalab.unc.edu/xql/"
	xmlns:cti="http://cti.library.emory.edu/"
	version="1.0">

  <!-- summary mode:
       brief display of series & subseries (hits if keyword search)
       -->

  <xsl:template match="dsc/head" mode="summary">
    <h2><xsl:value-of select="text()"/></h2>		
  </xsl:template>
	
  <xsl:template match="c01|c02|c03" mode="summary">
    <h4>
      <xsl:attribute name="class"><xsl:value-of select="local-name()"/></xsl:attribute> 
      <xsl:element name="a">
        <xsl:attribute name="href">content.php?el=<xsl:value-of select="local-name()"/>&amp;id=<xsl:value-of select="self::node()/@id"/><xsl:value-of select="$url_suffix"/></xsl:attribute>			
        <xsl:value-of select="did/unitid"/>
        <xsl:text>: &#x00A0;</xsl:text>
        <xsl:value-of select="did/unittitle"/>
      </xsl:element>
      
      <!-- note: hits are *inside* h4 to keep them on the same line -->      
      
      <!-- if we have the full-text, count matches under this node -->
      <xsl:variable name="count"><xsl:value-of select="count(.//exist:match)"/> </xsl:variable>
      
      <xsl:choose>
        <xsl:when test="$count > 0">
          <span class="hits"><xsl:value-of select="$count"/> hit<xsl:if test="$count > 1">s</xsl:if></span>
        </xsl:when>
        <!-- if not full-text, use results from exist match-count -->
        <xsl:when test="local-name() != 'c01' and hits > 0">
          <!-- FIXME : temporary fix because of a bug in eXist's match-count; 
               correctly detects hits / no hits in subseries, but count is inaccurate. -->
          <span class="hits">hits</span>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="hits"/>
        </xsl:otherwise>
      </xsl:choose>
    </h4>            
    
      <!-- FIXME: how to get did/physdesc here for pdf output ?
           output with id & hide with css? -->

    <!-- if there are subseries, indent to display hierarchy -->
    <xsl:if test="count(c02[@level='subseries']) + count(c03[@level='subseries']) > 0">
      <ul>
        <xsl:apply-templates select="c02[@level='subseries']|c03[@level='subseries']" mode="summary"/>
      </ul>
    </xsl:if>
  </xsl:template>

	
</xsl:stylesheet>

{'fraction_non_alphanumeric': 0.1952662721893491, 'fraction_numerical': 0.015215553677092139, 'mean_word_length': 2.7444620253164556, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 125, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7356435', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1539, 'n_words': 312}