Skip to content

Instantly share code, notes, and snippets.

View dmj's full-sized avatar

David Maus dmj

View GitHub Profile
@dmj
dmj / extract-schematron.xsl
Created May 13, 2023 13:43
Extract embedded ISO Schematron
<xsl:transform version="3.0" expand-text="yes"
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode on-no-match="shallow-skip" use-accumulators="namespaces"/>
<xsl:param name="queryBinding" as="xs:string">xslt3</xsl:param>
<xsl:accumulator name="namespaces" as="element(sch:ns)*" initial-value="()">
<?php
namespace SUBHH\VuFind\RecordDescription;
use SUBHH\VuFind\SolrMarc\SolrMarc;
interface DescriptionProviderInterface
{
/** @return array<string, DisplayValueInterface[]> */
public function createDescription (SolrMarc $record) : array;
@dmj
dmj / simple-old.rng
Created March 8, 2023 13:45
attDef/datatype/dataRef
<?xml version="1.0" encoding="utf-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:teix="http://www.tei-c.org/ns/Examples"
xmlns:xlink="http://www.w3.org/1999/xlink"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://www.tei-c.org/ns/1.0"><!--
Schema generated from ODD source 2023-03-08T13:44:40Z. .
TEI Edition: Version 4.4.0. Last updated on
19th April 2022, revision ff9cc28b0
<project name="Test" basedir="." default="build">
<taskdef name="schematron" classname="name.dmaus.schxslt.ant.Task" classpath="target/ant-schxslt-1.9.5.jar"/>
<target name="build">
<schematron schema="schema.sch" file="document.xml" report="report.xml"/>
</target>
</project>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>TEI ODDities: Using the @preserveOrder attribute on sequence</title>
</titleStmt>
<publicationStmt>
<publisher>David Maus</publisher>
</publicationStmt>
<sourceDesc>
@dmj
dmj / document.odd
Created January 18, 2023 16:09
Dehmel Digital Pure ODD Schema
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Schema der annotierten Volltexte</title>
</titleStmt>
<publicationStmt>
<publisher>Staats- und Universitätsbibliothek Hamburg</publisher>
</publicationStmt>
<sourceDesc>
@dmj
dmj / example.xsl
Created July 27, 2022 10:38
XSpec using throw/catch
<xsl:transform version="3.0" expand-text="yes"
xmlns:atop="http://www.tei-c.org/ns/atop"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode on-no-match="shallow-copy"/>
<xsl:template match="no-error-code">
<xsl:message terminate="yes"/>
</xsl:template>
<document attribute="some value"/>
@literalws = right
json = ~ value ~
value = string | number | object | array | "true" | "false" | "null"
string = `"` { anyUnicodeCharacterExceptQuoteOrBackslashOrControlCharacter | `\"` | `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\u` fourHexadecimalDigits } `"`
anyUnicodeCharacterExceptQuoteOrBackslashOrControlCharacter = ! /["\\]/ alphabet
alphabet = /[\u0009\u000A\u000D\u0020-\uD7FF#\uE000-\uFFFD\u10000-\u10FFFF]/
fourHexadecimalDigits = /[0-9A-Fa-f]{4}/
digit = /[0-9]/
digitOneThroughNine = /[1-9]/
<p:declare-step version="3.0"
xmlns:edm="http://www.europeana.eu/schemas/edm/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:xs="http://www.w3.org/2001/XMLSchema">