<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!-- 	Author: <NAME>
	Date: June 2017
	Function: There are two modes of templates to render SPARQL results into HTML:
	   1. type-examples renders examples of physical specimens related to coin types displayed on coin type pages
	   2. examples of coin types associated with a symbol
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:res="http://www.w3.org/2005/sparql-results#"
    xmlns:numishare="https://github.com/ewg118/numishare" exclude-result-prefixes="#all" version="2.0">

    <!-- **************** PHYSICAL EXAMPLES OF COIN TYPES ****************-->
    <xsl:template match="res:sparql" mode="type-examples">
        <xsl:param name="subtype" select="doc('input:request')/request/parameters/parameter[name = 'subtype']/value"/>

        <xsl:variable name="count" select="count(descendant::res:result)"/>

        <div class="row">
            <xsl:if test="not($subtype = 'true')">
                <xsl:attribute name="id">examples</xsl:attribute>
            </xsl:if>
            <xsl:if test="$count &gt; 0">
                <div class="col-md-12">
                    <xsl:element name="{if($subtype='true') then 'h4' else 'h3'}">
                        <xsl:value-of select="numishare:normalizeLabel('display_examples', $lang)"/>
                    </xsl:element>
                </div>
                <xsl:apply-templates select="descendant::res:result" mode="type-examples"/>
            </xsl:if>
        </div>
    </xsl:template>

    <xsl:template match="res:result" mode="type-examples">
        <xsl:variable name="title"
            select="
            concat(res:binding[@name = 'identifier']/res:literal, ': ', if
            (string(res:binding[@name = 'collection']/res:literal)) then
            res:binding[@name = 'collection']/res:literal
            else
            res:binding[@name = 'datasetTitle']/res:literal)"/>
        
        <div class="g_doc col-md-4">
            <span class="result_link">
                <a href="{res:binding[@name='object']/res:uri}" target="_blank"><commit_msg>displaying identifier as URI or literal<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!-- 	Author: <NAME>
	Date: June 2017
	Function: There are two modes of templates to render SPARQL results into HTML:
	   1. type-examples renders examples of physical specimens related to coin types displayed on coin type pages
	   2. examples of coin types associated with a symbol
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:res="http://www.w3.org/2005/sparql-results#"
    xmlns:numishare="https://github.com/ewg118/numishare" exclude-result-prefixes="#all" version="2.0">

    <!-- **************** PHYSICAL EXAMPLES OF COIN TYPES ****************-->
    <xsl:template match="res:sparql" mode="type-examples">
        <xsl:param name="subtype" select="doc('input:request')/request/parameters/parameter[name = 'subtype']/value"/>

        <xsl:variable name="count" select="count(descendant::res:result)"/>

        <div class="row">
            <xsl:if test="not($subtype = 'true')">
                <xsl:attribute name="id">examples</xsl:attribute>
            </xsl:if>
            <xsl:if test="$count &gt; 0">
                <div class="col-md-12">
                    <xsl:element name="{if($subtype='true') then 'h4' else 'h3'}">
                        <xsl:value-of select="numishare:normalizeLabel('display_examples', $lang)"/>
                    </xsl:element>
                </div>
                <xsl:apply-templates select="descendant::res:result" mode="type-examples"/>
            </xsl:if>
        </div>
    </xsl:template>

    <xsl:template match="res:result" mode="type-examples">
        <xsl:variable name="title"
            select="
            concat(res:binding[@name = 'identifier']/*, ': ', if
            (string(res:binding[@name = 'collection']/res:literal)) then
            res:binding[@name = 'collection']/res:literal
            else
            res:binding[@name = 'datasetTitle']/res:literal)"/>
        
        <div class="g_doc col-md-4">
            <span class="result_link">
                <a href="{res:binding[@name='object']/res:uri}" target="_blank">
{'fraction_non_alphanumeric': 0.18035055350553506, 'fraction_numerical': 0.01614391143911439, 'mean_word_length': 2.745250431778929, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 2, '>': 59, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, 'xml': 10}, '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': '1554604', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1266, 'n_words': 252}