File tree 6 files changed +195
-0
lines changed
03_step-library/39_practice
6 files changed +195
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <p : declare-step xmlns : p =" http://www.w3.org/ns/xproc"
3
+ xmlns : c =" http://www.w3.org/ns/xproc-step" version =" 1.0" >
4
+
5
+ <!-- 1. Dokument laden und mit Schematron und RelaxNG/XSD prüfen
6
+ 2. HTML transformieren
7
+ 3. Report ausgeben-->
8
+
9
+ <p : input port =" source" >
10
+
11
+ </p : input >
12
+
13
+ <p : output port =" result" />
14
+
15
+ </p : declare-step >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <?xml-model href =" my-checks.sch" type =" application/xml" schematypens =" http://purl.oclc.org/dsdl/schematron" ?>
3
+ <doc schema-version =" 1.0" >
4
+ <section >
5
+ <para >Some text</para >
6
+ <image fileref =" image1.png" role =" graphic" />
7
+ <image fileref =" image2.png" role =" photograph" />
8
+ </section >
9
+ <section >
10
+ <para >Some text again</para >
11
+ <image fileref =" image3.png" role =" graphic" />
12
+ </section >
13
+ </doc >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <schema xmlns =" http://purl.oclc.org/dsdl/schematron"
3
+ queryBinding =" xslt2" >
4
+
5
+ <pattern >
6
+ <rule context =" /doc" >
7
+ <assert test =" @schema-version eq '2.0'" >
8
+ Version 2.0 is required. Supplied version '<value-of select =" @schema-version" />' is wrong.
9
+ </assert >
10
+ </rule >
11
+ </pattern >
12
+
13
+ </schema >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <grammar xmlns =" http://relaxng.org/ns/structure/1.0"
3
+ datatypeLibrary =" http://www.w3.org/2001/XMLSchema-datatypes" >
4
+
5
+ <start >
6
+ <element name =" doc" >
7
+ <ref name =" doc.atts" />
8
+ <oneOrMore >
9
+ <ref name =" section.model" />
10
+ </oneOrMore >
11
+ </element >
12
+ </start >
13
+
14
+ <define name =" section.model" >
15
+ <element name =" section" >
16
+ <zeroOrMore >
17
+ <choice >
18
+ <ref name =" para.model" />
19
+ <ref name =" image.model" />
20
+ </choice >
21
+ </zeroOrMore >
22
+ </element >
23
+ </define >
24
+
25
+ <define name =" para.model" >
26
+ <element name =" para" >
27
+ <optional >
28
+ <ref name =" para.atts" />
29
+ </optional >
30
+ <text />
31
+ </element >
32
+ </define >
33
+
34
+ <define name =" image.model" >
35
+ <element name =" image" >
36
+ <interleave >
37
+ <optional >
38
+ <ref name =" image.atts" ></ref >
39
+ </optional >
40
+ </interleave >
41
+ </element >
42
+ </define >
43
+
44
+ <define name =" doc.atts" >
45
+ <attribute name =" schema-version" >
46
+ <value >1.0</value >
47
+ </attribute >
48
+ </define >
49
+
50
+ <define name =" para.atts" >
51
+ <attribute name =" role" />
52
+ </define >
53
+
54
+ <define name =" image.atts" >
55
+ <attribute name =" role" />
56
+ <attribute name =" fileref" />
57
+ </define >
58
+
59
+ </grammar >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <xs : schema xmlns : xs =" http://www.w3.org/2001/XMLSchema" elementFormDefault =" qualified" >
3
+
4
+ <xs : element name =" doc" >
5
+ <xs : complexType >
6
+ <xs : sequence >
7
+ <xs : element maxOccurs =" unbounded" ref =" section" />
8
+ </xs : sequence >
9
+ <xs : attributeGroup ref =" doc.atts" />
10
+ </xs : complexType >
11
+ </xs : element >
12
+
13
+ <xs : element name =" section" >
14
+ <xs : complexType >
15
+ <xs : choice minOccurs =" 0" maxOccurs =" unbounded" >
16
+ <xs : element ref =" para" />
17
+ <xs : element ref =" image" />
18
+ </xs : choice >
19
+ </xs : complexType >
20
+ </xs : element >
21
+
22
+ <xs : element name =" para" >
23
+ <xs : complexType mixed =" true" >
24
+ <xs : attribute name =" role" />
25
+ </xs : complexType >
26
+ </xs : element >
27
+
28
+ <xs : element name =" image" >
29
+ <xs : complexType >
30
+ <xs : attribute name =" role" />
31
+ <xs : attribute name =" fileref" />
32
+ </xs : complexType >
33
+ </xs : element >
34
+
35
+ <xs : attributeGroup name =" doc.atts" >
36
+ <xs : attribute name =" schema-version" use =" required" >
37
+ <xs : simpleType >
38
+ <xs : restriction base =" xs:token" >
39
+ <xs : enumeration value =" 1.0" />
40
+ </xs : restriction >
41
+ </xs : simpleType >
42
+ </xs : attribute >
43
+ </xs : attributeGroup >
44
+
45
+ <xs : attributeGroup name =" para.atts" >
46
+ <xs : attribute name =" role" use =" required" />
47
+ </xs : attributeGroup >
48
+
49
+ <xs : attributeGroup name =" image.atts" >
50
+ <xs : attribute name =" role" use =" required" />
51
+ <xs : attribute name =" fileref" use =" required" />
52
+ </xs : attributeGroup >
53
+
54
+ </xs : schema >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <xsl : stylesheet xmlns : xsl =" http://www.w3.org/1999/XSL/Transform"
3
+ xmlns =" http://www.w3.org/1999/xhtml"
4
+ version =" 2.0" >
5
+
6
+ <xsl : param name =" lang" />
7
+
8
+ <xsl : template match =" /doc" >
9
+ <html lang =" {$lang}" >
10
+ <head >
11
+ <title >my doc</title >
12
+ </head >
13
+ <body >
14
+ <xsl : apply-templates />
15
+ </body >
16
+ </html >
17
+ </xsl : template >
18
+
19
+ <xsl : template match =" sect" >
20
+ <section >
21
+ <xsl : apply-templates />
22
+ </section >
23
+ </xsl : template >
24
+
25
+ <xsl : template match =" title" >
26
+ <h1 >
27
+ <xsl : apply-templates />
28
+ </h1 >
29
+ </xsl : template >
30
+
31
+ <xsl : template match =" para" >
32
+ <p >
33
+ <xsl : apply-templates />
34
+ </p >
35
+ </xsl : template >
36
+
37
+ <xsl : template match =" image" >
38
+ <img src =" {@fileref}" />
39
+ </xsl : template >
40
+
41
+ </xsl : stylesheet >
You can’t perform that action at this time.
0 commit comments