Created
November 13, 2024 23:23
-
-
Save djbpitt/8c9e7168a8124530648459c87844586c to your computer and use it in GitHub Desktop.
Mitford placename exploration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" xpath-default-namespace="http://www.tei-c.org/ns/1.0" | |
xmlns="http://www.w3.org/1999/xhtml" xmlns:math="http://www.w3.org/2005/xpath-functions/math" | |
exclude-result-prefixes="#all" version="3.0"> | |
<xsl:output method="xhtml" html-version="5" omit-xml-declaration="no" include-content-type="no" | |
indent="yes"/> | |
<!-- ================================================================= --> | |
<!-- Stylesheet variables --> | |
<!-- ================================================================= --> | |
<xsl:variable name="corpus" as="document-node()+" select="collection('data?select=*.xml')"/> | |
<xsl:variable name="gazetteer" as="document-node()" | |
select="document('http://raw.githubusercontent.com/DigitalMitford/DM_SiteIndex/refs/heads/master/si_Full_Staged/si.xml')"/> | |
<!-- ================================================================= --> | |
<!-- Templates --> | |
<!-- ================================================================= --> | |
<xsl:template name="xsl:initial-template"> | |
<html> | |
<head> | |
<title>Mitford places</title> | |
</head> | |
<body> | |
<h1>Place references in Mitford letters</h1> | |
<xsl:apply-templates select="$corpus"/> | |
</body> | |
</html> | |
</xsl:template> | |
<xsl:template match="/"> | |
<section> | |
<h2> | |
<xsl:value-of select="descendant::titleStmt/title"/> | |
</h2> | |
<ul> | |
<xsl:for-each select="descendant::placeName ! substring(@ref, 2) => distinct-values()"> | |
<xsl:sort/> | |
<li> | |
<xsl:value-of | |
select="concat(translate(., '_', ' '), ': ', id(., $gazetteer) ! (descendant::geo, 'NO GEO DATA')[1])" | |
/> | |
</li> | |
</xsl:for-each> | |
</ul> | |
</section> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment