<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfa="http://www.w3.org/ns/rdfa#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xhtml="http://www.w3.org/1999/xhtml"
	xmlns:nm="http://nomisma.org/id/" exclude-result-prefixes="xhtml xsl xs nm rdf rdfa skos" version="2.0">

	<xsl:param name="id-path"/>
	<xsl:param name="identifiers"/>
	<xsl:param name="lang"/>

	<xsl:variable name="content" as="element()*">
		<content xmlns="http://www.w3.org/1999/xhtml">
			<xsl:for-each select="tokenize($identifiers, '\|')">
				<xsl:if test="doc-available(concat($id-path, '/', ., '.txt'))">
					<xsl:copy-of select="document(concat($id-path, '/', ., '.txt'))/*"/>
				</xsl:if>
			</xsl:for-each>
		</content>
	</xsl:variable>

	<xsl:variable name="rdf" as="element()*">
		<rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nm="http://nomisma.org/id/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
			xmlns:rdfa="http://www.w3.org/ns/rdfa#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
			<xsl:variable name="id-param">
				<xsl:text>struck|</xsl:text>
				<xsl:for-each select="distinct-values($content/descendant::*/@resource)">
					<xsl:value-of select="."/>
					<xsl:if test="not(position()=last())">
						<xsl:text>|</xsl:text>
					</xsl:if>
				</xsl:for-each>
			</xsl:variable>

			<xsl:variable name="rdf_url" select="concat('cocoon:/apis/getRdf?identifiers=', $id-param)"/>
			<xsl:copy-of select="document($rdf_url)/rdf:RDF/*"/>
		</rdf:RDF>
	</xsl:variable>

	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="count($content/xhtml:div) = 1">
				<xsl:apply-templates select="$content/xhtml:div"/>
			</xsl:when>
			<xsl:when test="count($content/xhtml:div) &gt; 1">
				<nudsGroup xmlns="http://nomisma.org/nuds" xmlns:xlink="http://www.w3.org/1999/xlink">
					<xsl:apply-templates select="$content/xhtml:div"/>
				</nudsGroup>
			</xsl:when>
		</xsl:choose>
	</xsl:template>

	<!--***************************************** Process Nomisma Coin Type XHTML+RDFa into NUDS **************************************** -->
	<xsl:template match="xhtml:div[@typeof='type_series_item']">
		<nuds xmlns="http://nomisma.org/nuds" xmlns:xlink="http://www.w3.org/1999/xlink">
			<nudsHeader>
				<nudsid>
					<xsl:value-of select="@about"/>
				</nudsid>
			</nudsHeader>
			<descMeta>
				<!-- title -->
				<xsl:choose>
					<xsl:when test="xhtml:div[@property='skos:prefLabel'][@xml:lang=$lang]">
						<title xml:lang="{$lang}">
							<xsl:value-of select="xhtml:div[@property='skos:prefLabel'][@xml:lang=$lang]"/>
						</title>
					</xsl:when><commit_msg>updating from nudsHeader to control<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfa="http://www.w3.org/ns/rdfa#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xhtml="http://www.w3.org/1999/xhtml"
	xmlns:nm="http://nomisma.org/id/" exclude-result-prefixes="xhtml xsl xs nm rdf rdfa skos" version="2.0">

	<xsl:param name="id-path"/>
	<xsl:param name="identifiers"/>
	<xsl:param name="lang"/>

	<xsl:variable name="content" as="element()*">
		<content xmlns="http://www.w3.org/1999/xhtml">
			<xsl:for-each select="tokenize($identifiers, '\|')">
				<xsl:if test="doc-available(concat($id-path, '/', ., '.txt'))">
					<xsl:copy-of select="document(concat($id-path, '/', ., '.txt'))/*"/>
				</xsl:if>
			</xsl:for-each>
		</content>
	</xsl:variable>

	<xsl:variable name="rdf" as="element()*">
		<rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nm="http://nomisma.org/id/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
			xmlns:rdfa="http://www.w3.org/ns/rdfa#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
			<xsl:variable name="id-param">
				<xsl:text>struck|</xsl:text>
				<xsl:for-each select="distinct-values($content/descendant::*/@resource)">
					<xsl:value-of select="."/>
					<xsl:if test="not(position()=last())">
						<xsl:text>|</xsl:text>
					</xsl:if>
				</xsl:for-each>
			</xsl:variable>

			<xsl:variable name="rdf_url" select="concat('cocoon:/apis/getRdf?identifiers=', $id-param)"/>
			<xsl:copy-of select="document($rdf_url)/rdf:RDF/*"/>
		</rdf:RDF>
	</xsl:variable>

	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="count($content/xhtml:div) = 1">
				<xsl:apply-templates select="$content/xhtml:div"/>
			</xsl:when>
			<xsl:when test="count($content/xhtml:div) &gt; 1">
				<nudsGroup xmlns="http://nomisma.org/nuds" xmlns:xlink="http://www.w3.org/1999/xlink">
					<xsl:apply-templates select="$content/xhtml:div"/>
				</nudsGroup>
			</xsl:when>
		</xsl:choose>
	</xsl:template>

	<!--***************************************** Process Nomisma Coin Type XHTML+RDFa into NUDS **************************************** -->
	<xsl:template match="xhtml:div[@typeof='type_series_item']">
		<nuds xmlns="http://nomisma.org/nuds" xmlns:xlink="http://www.w3.org/1999/xlink">
			<control>
				<recordId>
					<xsl:value-of select="@about"/>
				</recordId>
			</control>
			<descMeta>
				<!-- title -->
				<xsl:choose>
					<xsl:when test="xhtml:div[@property='skos:prefLabel'][@xml:lang=$lang]">
						<title xml:lang="{$lang}">
							<xsl:value-of select="xhtml:div[@property='skos:prefLabel'][@xml:lang=$lang]"/>
						</title>
					</xsl:when>
{'fraction_non_alphanumeric': 0.2677595628415301, 'fraction_numerical': 0.02971311475409836, 'mean_word_length': 4.4281742354031515, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 2, '>': 121, 'https://': 0, 'lorem ipsum': 0, 'www.': 28, 'xml': 48}, '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': '1180252', 'n_tokens_mistral': 2828, 'n_tokens_neox': 2280, 'n_words': 255}