-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Maus
committed
Oct 10, 2017
0 parents
commit f4dc29d
Showing
8 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.xsd | ||
*.rng | ||
*.sch | ||
/test/*-compiled.xspec | ||
/test/xspec |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
XSPEC = xspec.cmd | ||
TRANG = java -jar lib/trang.jar | ||
SAXON = java -jar lib/saxon9he.jar | ||
|
||
%.rng: %.rnc | ||
$(TRANG) -I rnc -O rng $< $@ | ||
|
||
%.xsd: %.rnc | ||
$(TRANG) -I rnc -O xsd $< $@ | ||
|
||
%.sch: %.rng | ||
$(SAXON) -xsl:lib/rngsch.xsl -o:$@ $< | ||
|
||
test: src/ruleset.sch | ||
$(XSPEC) -s test/ruleset.xspec | ||
|
||
all: src/ruleset.xsd src/ruleset.rng src/ruleset.sch test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Schemata für Kitodo.Production | ||
== |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<xsl:transform version="2.0" | ||
xmlns:sch="http://purl.oclc.org/dsdl/schematron" | ||
xmlns:rng="http://relaxng.org/ns/structure/1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
|
||
<xsl:template match="rng:grammar"> | ||
<sch:schema queryBinding="xslt2"> | ||
<xsl:apply-templates/> | ||
</sch:schema> | ||
</xsl:template> | ||
|
||
<xsl:template match="sch:*"> | ||
<xsl:sequence select="."/> | ||
</xsl:template> | ||
|
||
<xsl:template match="text()"/> | ||
|
||
</xsl:transform> |
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# -*- mode: rnc; -*- | ||
# | ||
# RelaxNG Schema für Kitido.Production Regelsatz | ||
# | ||
# Author: David Maus <[email protected]> | ||
# Timestamp: <2017-10-10 15:16:42 maus> | ||
# | ||
|
||
namespace s = "http://purl.oclc.org/dsdl/schematron" | ||
|
||
start = Preferences | ||
|
||
Preferences = | ||
element Preferences { | ||
element debug { "0" | "1" }?, | ||
MetadataTypeDef* | ||
} | ||
|
||
MetadataTypeDef = | ||
element Metadata { | ||
attribute type { "person" | "identifier" }?, | ||
( | ||
Name | ||
& NameTranslation* | ||
) | ||
} | ||
|
||
Name = | ||
## Interner Name des Metadaten- oder Strukturtyps. Der Name wird zur Referenzierung benutzt und muss daher dokumentweit eindeutig sein. | ||
element Name { xsd:NMTOKEN } | ||
|
||
NameTranslation = | ||
## Übersetzung eines Namens in die über das Attribut @name spezifizierte Sprache. | ||
element language { | ||
attribute name { xsd:language }, | ||
text | ||
} | ||
|
||
StructTypeDef = | ||
element DocStrctType { | ||
attribute anchor { "true" }? | ||
& Name | ||
& NameTranslation | ||
& AllowedChildStruct* | ||
& AllowedMetadata* | ||
} | ||
|
||
AllowedChildStruct = | ||
[ | ||
s:pattern [ | ||
s:rule [ | ||
context = "allowedchildtype" s:assert [ | ||
test = "/Preferences/DocStrctType[Name = .]" | ||
"Der Strukturtyp '" s:value-of [ select = "." ] "' muss definiert werden." | ||
] | ||
] | ||
] | ||
] | ||
element allowedchildtype { | ||
xsd:NMTOKEN | ||
} | ||
|
||
AllowedMetadata = | ||
[ | ||
s:pattern [ | ||
s:rule [ | ||
context = "metadata[parent::DocStrctType]" s:assert [ | ||
test = "/Preferences/MetadataType[Name = .]" | ||
"Das Metadatum '" s:value-of [ select = "." ] "' muss definiert werden." | ||
] | ||
] | ||
] | ||
] | ||
element metadata { | ||
attribute num { "*" | "+" | "1o" | "1m" }?, | ||
attribute DefaultDisplay { text }?, | ||
xsd:NMTOKEN | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="../src/ruleset.sch"> | ||
<scenario label="Definition der Strukturtypen"> | ||
<scenario label="Untergeordneter Strukturtyp ist definiert"> | ||
<context> | ||
<Preferences xmlns=""> | ||
<DocStrctType> | ||
<Name>is-defined</Name> | ||
</DocStrctType> | ||
<DocStrctType> | ||
<allowedchildtype>is-defined</allowedchildtype> | ||
</DocStrctType> | ||
</Preferences> | ||
</context> | ||
<expect-assert/> | ||
</scenario> | ||
<scenario label="Untergeordneter Strukturtyp ist nicht definiert"> | ||
<context> | ||
<Preferences xmlns=""> | ||
<DocStrctType> | ||
<allowedchildtype>is-not-defined</allowedchildtype> | ||
</DocStrctType> | ||
</Preferences> | ||
</context> | ||
<expect-assert/> | ||
</scenario> | ||
</scenario> | ||
</description> |