Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 36f9e91

Browse files
committed
Initial commit
0 parents  commit 36f9e91

File tree

14 files changed

+1307
-0
lines changed

14 files changed

+1307
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018-2022 David Maus
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SchXslt Redux XSLT1
2+
3+
A feature complete implementation of an XSLT 1.0 ISO Schematron processor for the XSLT 1.0 query language binding.
4+
5+
SchXslt Redux XSLT1 is copyright (c) 2018-2022 by David Maus and released under the terms of the MIT license.
6+
7+
## About
8+
9+
This is a trimmed down version of the XSLT 1.0 processor of SchXslt. The processor is implemend as a series of XSLT
10+
transformation that transpile a ISO Schematron schema to an XSLT validation stylesheet. The validation stylesheet
11+
creates a SVRL report when applied to a document instance.
12+
13+
Transpiling a schema is done in three steps.
14+
15+
The stylesheet [1-include.xsl](src/main/resources/content/1-include.xsl) assembles a complete schema by resolving
16+
and internalizing external definitions. It acts on the ```sch:include``` and the ```sch:extends``` with a ```@href```
17+
attribute.
18+
19+
The stylesheet [2-expand.xsl](src/main/resources/content/2-expand.xsl) expands (instantiates) abstract rules and
20+
abstract patterns.
21+
22+
The stylesheet [3-transpile.xsl](src/main/resources/content/3-transpile.xsl) transpiles the schema to the XSLT
23+
validation stylesheet.
24+
25+
SchXslt Redux XSLT1 is a *strict* implementation of ISO Schematron. If you switch from a different implementation such
26+
as [SchXslt](https://github.com/schxslt/schxslt) or the ["Skeleton"](https://github.com/schematron/schematron) your
27+
schema files might not work as expected.
28+
29+
## Limitations
30+
31+
SchXslt Redux XSLT1 comes with the following limitations.
32+
33+
Schematron variables scoped to a phase or pattern are promoted to global XSLT variables.
34+
35+
Schematron variables cannot be used in the rule context expression. XSLT 1.0 [forbids the
36+
use](https://www.w3.org/TR/1999/REC-xslt-19991116#section-Defining-Template-Rules) of variable references in match
37+
patterns.
38+
39+
The URI of the primary document is neither reported in the ```svrl:active-pattern/@documents```, nor in the
40+
```svrl:fired-rule/@document``` attribute. XSLT 1.0 does not provide a function to access the URI of a document..
41+
42+
## Installation and Usage
43+
44+
The [Github releases page](https://github.com/schxslt/schxslt-redux-xslt1/releases) provides a ZIP file with the
45+
processor stylesheets. Download and unzip the file in an appropriate location. Users of [eXist](https://existdb.org) and
46+
[BaseX](https://basex.org) can download and import an EXPath package from the [releases
47+
page](https://github.com/schxslt/schxslt-redux-xslt1/releases), too.
48+
49+
Java users can use the artifact ```name.dmaus.schxslt.schxslt-redux-xslt1``` from Maven Central.
50+
51+
PHP users can use the package ```schxslt/redux-xslt1``` from [Packagist](https://packagist.org). The package provides a
52+
class ```SchXslt\Xslt1\Locator``` with a ```getStylesheets()``` method that returns an array with the paths to the
53+
stylesheets.
54+
55+
## Authors
56+
57+
David Maus <[email protected]>

composer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "schxslt/redux-xslt1",
3+
"description": "An implementation of an XSLT 1.0 ISO Schematron processor for the XSLT 1.0 query language binding",
4+
"keywords": [ "schematron", "xml", "validation" ],
5+
"homepage": "https://github.com/schxslt/schxslt-redux-xslt1",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "David Maus",
10+
"email": "[email protected]",
11+
"homepage": "https://dmaus.name"
12+
}
13+
],
14+
"support": {
15+
"source": "https://github.com/schxslt/schxslt-redux-xslt1",
16+
"issues": "https://github.com/schxslt/schxslt-redux-xslt1/issues"
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"SchXslt\\Xslt1\\": "src/main/php"
21+
}
22+
}
23+
}

pom.xml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>name.dmaus.schxslt</groupId>
5+
<artifactId>schxslt-redux-xslt1</artifactId>
6+
<version>1.0.0</version>
7+
8+
<name>SchXslt Redux XSLT1</name>
9+
<url>https://doi.org/10.5281/zenodo.7268370</url>
10+
<description>A feature complete implementation of an XSLT 1.0 ISO Schematron processor for the XSLT 1.0 query language binding</description>
11+
12+
<distributionManagement>
13+
<repository>
14+
<id>ossrh</id>
15+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
16+
</repository>
17+
<snapshotRepository>
18+
<id>ossrh</id>
19+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
20+
</snapshotRepository>
21+
</distributionManagement>
22+
23+
<licenses>
24+
<license>
25+
<name>MIT License</name>
26+
<url>https://opensource.org/licenses/MIT</url>
27+
<distribution>repo</distribution>
28+
</license>
29+
</licenses>
30+
31+
<developers>
32+
<developer>
33+
<id>dmaus</id>
34+
<name>David Maus</name>
35+
<email>[email protected]</email>
36+
</developer>
37+
</developers>
38+
39+
<scm>
40+
<url>https://github.com/schxslt/schxslt-redux-xslt1</url>
41+
<connection>scm:git:https://github.com/schxslt/schxslt-redux-xslt1.git</connection>
42+
</scm>
43+
44+
<issueManagement>
45+
<url>https://github.com/schxslt/schxslt-redux-xslt1/issues</url>
46+
<system>GitHub Issues</system>
47+
</issueManagement>
48+
49+
<properties>
50+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
51+
</properties>
52+
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<artifactId>maven-resources-plugin</artifactId>
57+
<version>3.2.0</version>
58+
<executions>
59+
<execution>
60+
<id>prepare-zip</id>
61+
<phase>validate</phase>
62+
<goals>
63+
<goal>copy-resources</goal>
64+
</goals>
65+
<configuration>
66+
<outputDirectory>${project.build.directory}/xslt-only</outputDirectory>
67+
<resources>
68+
<resource>
69+
<directory>src/main/resources</directory>
70+
<filtering>true</filtering>
71+
</resource>
72+
</resources>
73+
</configuration>
74+
</execution>
75+
</executions>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-assembly-plugin</artifactId>
80+
<version>3.3.0</version>
81+
<configuration>
82+
<appendAssemblyId>false</appendAssemblyId>
83+
</configuration>
84+
<executions>
85+
<!-- Build a ZIP file with only the XSLT stylesheets -->
86+
<execution>
87+
<id>zip</id>
88+
<phase>package</phase>
89+
<goals>
90+
<goal>single</goal>
91+
</goals>
92+
<configuration>
93+
<descriptors>
94+
<descriptor>src/assembly/xslt-only.xml</descriptor>
95+
</descriptors>
96+
<finalName>${project.artifactId}-${project.version}</finalName>
97+
</configuration>
98+
</execution>
99+
</executions>
100+
</plugin>
101+
<plugin>
102+
<groupId>com.coderplus.maven.plugins</groupId>
103+
<artifactId>copy-rename-maven-plugin</artifactId>
104+
<version>1.0.1</version>
105+
<executions>
106+
<execution>
107+
<id>rename-package</id>
108+
<phase>package</phase>
109+
<goals>
110+
<goal>copy</goal>
111+
</goals>
112+
<configuration>
113+
<sourceFile>${project.build.directory}/${project.artifactId}-${project.version}.zip</sourceFile>
114+
<destinationFile>${project.build.directory}/${project.artifactId}-${project.version}.xar</destinationFile>
115+
</configuration>
116+
</execution>
117+
</executions>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
122+
<profiles>
123+
<profile>
124+
<id>release</id>
125+
<build>
126+
<plugins>
127+
<plugin>
128+
<groupId>org.apache.maven.plugins</groupId>
129+
<artifactId>maven-gpg-plugin</artifactId>
130+
<version>3.0.1</version>
131+
<executions>
132+
<execution>
133+
<id>sign-artifacts</id>
134+
<phase>verify</phase>
135+
<goals>
136+
<goal>sign</goal>
137+
</goals>
138+
</execution>
139+
</executions>
140+
</plugin>
141+
<plugin>
142+
<groupId>org.apache.maven.plugins</groupId>
143+
<artifactId>maven-source-plugin</artifactId>
144+
<version>3.2.1</version>
145+
<executions>
146+
<execution>
147+
<id>attach-sources</id>
148+
<goals>
149+
<goal>jar</goal>
150+
</goals>
151+
</execution>
152+
</executions>
153+
</plugin>
154+
<plugin>
155+
<groupId>org.apache.maven.plugins</groupId>
156+
<artifactId>maven-javadoc-plugin</artifactId>
157+
<version>3.4.1</version>
158+
<executions>
159+
<execution>
160+
<id>attach-javadocs</id>
161+
<goals>
162+
<goal>jar</goal>
163+
</goals>
164+
</execution>
165+
</executions>
166+
</plugin>
167+
<plugin>
168+
<groupId>org.sonatype.plugins</groupId>
169+
<artifactId>nexus-staging-maven-plugin</artifactId>
170+
<version>1.6.13</version>
171+
<extensions>true</extensions>
172+
<configuration>
173+
<serverId>ossrh</serverId>
174+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
175+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
176+
</configuration>
177+
</plugin>
178+
</plugins>
179+
</build>
180+
</profile>
181+
</profiles>
182+
183+
</project>

src/assembly/xslt-only.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
4+
<id>xslt-only</id>
5+
<formats>
6+
<format>zip</format>
7+
</formats>
8+
<fileSets>
9+
<fileSet>
10+
<directory>${project.build.directory}/xslt-only</directory>
11+
<outputDirectory/>
12+
</fileSet>
13+
</fileSets>
14+
<files>
15+
<file>
16+
<source>LICENSE</source>
17+
</file>
18+
<file>
19+
<source>README.md</source>
20+
</file>
21+
</files>
22+
</assembly>

src/main/php/Locator.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
* Copyright (C) 2022 by David Maus <[email protected]>
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*/
26+
27+
namespace SchXslt\Xslt1;
28+
29+
final class Locator
30+
{
31+
private static $path = [__DIR__, '..', 'resources', 'content'];
32+
private $stylesheets = [];
33+
34+
public function __construct ()
35+
{
36+
$this->stylesheets = [
37+
implode(DIRECTORY_SEPARATOR, self::$path) . DIRECTORY_SEPARATOR . '1-include.xsl',
38+
implode(DIRECTORY_SEPARATOR, self::$path) . DIRECTORY_SEPARATOR . '2-expand.xsl',
39+
implode(DIRECTORY_SEPARATOR, self::$path) . DIRECTORY_SEPARATOR . '3-transpile.xsl',
40+
];
41+
}
42+
43+
public function getStylesheets ()
44+
{
45+
return $this->stylesheets;
46+
}
47+
}

0 commit comments

Comments
 (0)