From d541c8f8b460c7a82c1d2142706372f681293f75 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sun, 31 Jul 2005 16:49:51 +0000 Subject: [PATCH] report improvement more tests Daniel * schematron.c: report improvement * test/schematron/zvon* result/schematron/zvon*: more tests Daniel --- ChangeLog | 5 ++++ result/schematron/zvon11_0 | 4 +++ result/schematron/zvon11_0.err | 2 ++ result/schematron/zvon11_1 | 4 +++ result/schematron/zvon11_1.err | 3 +++ result/schematron/zvon11_2 | 4 +++ result/schematron/zvon11_2.err | 3 +++ result/schematron/zvon11_3 | 4 +++ result/schematron/zvon11_3.err | 2 ++ result/schematron/zvon12_0 | 4 +++ result/schematron/zvon12_0.err | 3 +++ result/schematron/zvon12_1 | 4 +++ result/schematron/zvon12_1.err | 2 ++ result/schematron/zvon12_2 | 4 +++ result/schematron/zvon12_2.err | 3 +++ result/schematron/zvon13_0 | 7 +++++ result/schematron/zvon13_0.err | 3 +++ result/schematron/zvon13_1 | 6 +++++ result/schematron/zvon13_1.err | 3 +++ result/schematron/zvon13_2 | 6 +++++ result/schematron/zvon13_2.err | 2 ++ result/schematron/zvon14_0 | 13 ++++++++++ result/schematron/zvon14_0.err | 4 +++ result/schematron/zvon15_0 | 5 ++++ result/schematron/zvon15_0.err | 4 +++ result/schematron/zvon4_0 | 7 +++++ result/schematron/zvon4_0.err | 3 +++ result/schematron/zvon4_1 | 7 +++++ result/schematron/zvon4_1.err | 3 +++ result/schematron/zvon5_0 | 6 +++++ result/schematron/zvon5_0.err | 7 +++++ result/schematron/zvon5_1 | 6 +++++ result/schematron/zvon5_1.err | 5 ++++ result/schematron/zvon5_2 | 8 ++++++ result/schematron/zvon5_2.err | 5 ++++ result/schematron/zvon6_0 | 4 +++ result/schematron/zvon6_0.err | 3 +++ result/schematron/zvon6_1 | 4 +++ result/schematron/zvon6_1.err | 3 +++ result/schematron/zvon6_2 | 4 +++ result/schematron/zvon6_2.err | 3 +++ result/schematron/zvon7_0 | 4 +++ result/schematron/zvon7_0.err | 3 +++ result/schematron/zvon7_1 | 4 +++ result/schematron/zvon7_1.err | 3 +++ result/schematron/zvon7_2 | 4 +++ result/schematron/zvon7_2.err | 3 +++ result/schematron/zvon7_3 | 4 +++ result/schematron/zvon7_3.err | 3 +++ result/schematron/zvon7_4 | 4 +++ result/schematron/zvon7_4.err | 3 +++ result/schematron/zvon8_0 | 9 +++++++ result/schematron/zvon8_0.err | 3 +++ result/schematron/zvon8_1 | 8 ++++++ result/schematron/zvon8_1.err | 3 +++ result/schematron/zvon8_2 | 8 ++++++ result/schematron/zvon8_2.err | 3 +++ result/schematron/zvon9_0 | 8 ++++++ result/schematron/zvon9_0.err | 2 ++ result/schematron/zvon9_1 | 8 ++++++ result/schematron/zvon9_1.err | 3 +++ result/schematron/zvon9_2 | 8 ++++++ result/schematron/zvon9_2.err | 3 +++ schematron.c | 47 +++++++++++++++++++++++++++++----- test/schematron/zvon11.sct | 8 ++++++ test/schematron/zvon11_0.xml | 3 +++ test/schematron/zvon11_1.xml | 3 +++ test/schematron/zvon11_2.xml | 3 +++ test/schematron/zvon11_3.xml | 3 +++ test/schematron/zvon12.sct | 8 ++++++ test/schematron/zvon12_0.xml | 3 +++ test/schematron/zvon12_1.xml | 3 +++ test/schematron/zvon12_2.xml | 3 +++ test/schematron/zvon13.sct | 7 +++++ test/schematron/zvon13_0.xml | 6 +++++ test/schematron/zvon13_1.xml | 5 ++++ test/schematron/zvon13_2.xml | 5 ++++ test/schematron/zvon14.sct | 10 ++++++++ test/schematron/zvon14_0.xml | 12 +++++++++ test/schematron/zvon15.sct | 11 ++++++++ test/schematron/zvon15_0.xml | 4 +++ test/schematron/zvon4.sct | 10 ++++++++ test/schematron/zvon4_0.xml | 6 +++++ test/schematron/zvon4_1.xml | 6 +++++ test/schematron/zvon5.sct | 12 +++++++++ test/schematron/zvon5_0.xml | 5 ++++ test/schematron/zvon5_1.xml | 5 ++++ test/schematron/zvon5_2.xml | 7 +++++ test/schematron/zvon6.sct | 8 ++++++ test/schematron/zvon6_0.xml | 3 +++ test/schematron/zvon6_1.xml | 3 +++ test/schematron/zvon6_2.xml | 3 +++ test/schematron/zvon7.sct | 9 +++++++ test/schematron/zvon7_0.xml | 3 +++ test/schematron/zvon7_1.xml | 3 +++ test/schematron/zvon7_2.xml | 3 +++ test/schematron/zvon7_3.xml | 3 +++ test/schematron/zvon7_4.xml | 3 +++ test/schematron/zvon8.sct | 10 ++++++++ test/schematron/zvon8_0.xml | 8 ++++++ test/schematron/zvon8_1.xml | 7 +++++ test/schematron/zvon8_2.xml | 7 +++++ test/schematron/zvon9.sct | 9 +++++++ test/schematron/zvon9_0.xml | 7 +++++ test/schematron/zvon9_1.xml | 7 +++++ test/schematron/zvon9_2.xml | 7 +++++ 106 files changed, 575 insertions(+), 6 deletions(-) create mode 100644 result/schematron/zvon11_0 create mode 100644 result/schematron/zvon11_0.err create mode 100644 result/schematron/zvon11_1 create mode 100644 result/schematron/zvon11_1.err create mode 100644 result/schematron/zvon11_2 create mode 100644 result/schematron/zvon11_2.err create mode 100644 result/schematron/zvon11_3 create mode 100644 result/schematron/zvon11_3.err create mode 100644 result/schematron/zvon12_0 create mode 100644 result/schematron/zvon12_0.err create mode 100644 result/schematron/zvon12_1 create mode 100644 result/schematron/zvon12_1.err create mode 100644 result/schematron/zvon12_2 create mode 100644 result/schematron/zvon12_2.err create mode 100644 result/schematron/zvon13_0 create mode 100644 result/schematron/zvon13_0.err create mode 100644 result/schematron/zvon13_1 create mode 100644 result/schematron/zvon13_1.err create mode 100644 result/schematron/zvon13_2 create mode 100644 result/schematron/zvon13_2.err create mode 100644 result/schematron/zvon14_0 create mode 100644 result/schematron/zvon14_0.err create mode 100644 result/schematron/zvon15_0 create mode 100644 result/schematron/zvon15_0.err create mode 100644 result/schematron/zvon4_0 create mode 100644 result/schematron/zvon4_0.err create mode 100644 result/schematron/zvon4_1 create mode 100644 result/schematron/zvon4_1.err create mode 100644 result/schematron/zvon5_0 create mode 100644 result/schematron/zvon5_0.err create mode 100644 result/schematron/zvon5_1 create mode 100644 result/schematron/zvon5_1.err create mode 100644 result/schematron/zvon5_2 create mode 100644 result/schematron/zvon5_2.err create mode 100644 result/schematron/zvon6_0 create mode 100644 result/schematron/zvon6_0.err create mode 100644 result/schematron/zvon6_1 create mode 100644 result/schematron/zvon6_1.err create mode 100644 result/schematron/zvon6_2 create mode 100644 result/schematron/zvon6_2.err create mode 100644 result/schematron/zvon7_0 create mode 100644 result/schematron/zvon7_0.err create mode 100644 result/schematron/zvon7_1 create mode 100644 result/schematron/zvon7_1.err create mode 100644 result/schematron/zvon7_2 create mode 100644 result/schematron/zvon7_2.err create mode 100644 result/schematron/zvon7_3 create mode 100644 result/schematron/zvon7_3.err create mode 100644 result/schematron/zvon7_4 create mode 100644 result/schematron/zvon7_4.err create mode 100644 result/schematron/zvon8_0 create mode 100644 result/schematron/zvon8_0.err create mode 100644 result/schematron/zvon8_1 create mode 100644 result/schematron/zvon8_1.err create mode 100644 result/schematron/zvon8_2 create mode 100644 result/schematron/zvon8_2.err create mode 100644 result/schematron/zvon9_0 create mode 100644 result/schematron/zvon9_0.err create mode 100644 result/schematron/zvon9_1 create mode 100644 result/schematron/zvon9_1.err create mode 100644 result/schematron/zvon9_2 create mode 100644 result/schematron/zvon9_2.err create mode 100644 test/schematron/zvon11.sct create mode 100644 test/schematron/zvon11_0.xml create mode 100644 test/schematron/zvon11_1.xml create mode 100644 test/schematron/zvon11_2.xml create mode 100644 test/schematron/zvon11_3.xml create mode 100644 test/schematron/zvon12.sct create mode 100644 test/schematron/zvon12_0.xml create mode 100644 test/schematron/zvon12_1.xml create mode 100644 test/schematron/zvon12_2.xml create mode 100644 test/schematron/zvon13.sct create mode 100644 test/schematron/zvon13_0.xml create mode 100644 test/schematron/zvon13_1.xml create mode 100644 test/schematron/zvon13_2.xml create mode 100644 test/schematron/zvon14.sct create mode 100644 test/schematron/zvon14_0.xml create mode 100644 test/schematron/zvon15.sct create mode 100644 test/schematron/zvon15_0.xml create mode 100644 test/schematron/zvon4.sct create mode 100644 test/schematron/zvon4_0.xml create mode 100644 test/schematron/zvon4_1.xml create mode 100644 test/schematron/zvon5.sct create mode 100644 test/schematron/zvon5_0.xml create mode 100644 test/schematron/zvon5_1.xml create mode 100644 test/schematron/zvon5_2.xml create mode 100644 test/schematron/zvon6.sct create mode 100644 test/schematron/zvon6_0.xml create mode 100644 test/schematron/zvon6_1.xml create mode 100644 test/schematron/zvon6_2.xml create mode 100644 test/schematron/zvon7.sct create mode 100644 test/schematron/zvon7_0.xml create mode 100644 test/schematron/zvon7_1.xml create mode 100644 test/schematron/zvon7_2.xml create mode 100644 test/schematron/zvon7_3.xml create mode 100644 test/schematron/zvon7_4.xml create mode 100644 test/schematron/zvon8.sct create mode 100644 test/schematron/zvon8_0.xml create mode 100644 test/schematron/zvon8_1.xml create mode 100644 test/schematron/zvon8_2.xml create mode 100644 test/schematron/zvon9.sct create mode 100644 test/schematron/zvon9_0.xml create mode 100644 test/schematron/zvon9_1.xml create mode 100644 test/schematron/zvon9_2.xml diff --git a/ChangeLog b/ChangeLog index 7cfd76dd..2d5a50a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 31 18:48:55 CEST 2005 Daniel Veillard + + * schematron.c: report improvement + * test/schematron/zvon* result/schematron/zvon*: more tests + Sun Jul 31 16:02:59 CEST 2005 Daniel Veillard * win32/Makefile.msvc win32/configure.js: applied patch from Rob diff --git a/result/schematron/zvon11_0 b/result/schematron/zvon11_0 new file mode 100644 index 00000000..49c80056 --- /dev/null +++ b/result/schematron/zvon11_0 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon11_0.err b/result/schematron/zvon11_0.err new file mode 100644 index 00000000..ab4aa742 --- /dev/null +++ b/result/schematron/zvon11_0.err @@ -0,0 +1,2 @@ +Pattern: Attributes present +./test/schematron/zvon11_0.xml validates diff --git a/result/schematron/zvon11_1 b/result/schematron/zvon11_1 new file mode 100644 index 00000000..a5328e0f --- /dev/null +++ b/result/schematron/zvon11_1 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon11_1.err b/result/schematron/zvon11_1.err new file mode 100644 index 00000000..c1ae2433 --- /dev/null +++ b/result/schematron/zvon11_1.err @@ -0,0 +1,3 @@ +Pattern: Attributes present +/AAA/BBB line 2: The element must not have an isolated bbb attribute +./test/schematron/zvon11_1.xml fails to validate diff --git a/result/schematron/zvon11_2 b/result/schematron/zvon11_2 new file mode 100644 index 00000000..673a7afd --- /dev/null +++ b/result/schematron/zvon11_2 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon11_2.err b/result/schematron/zvon11_2.err new file mode 100644 index 00000000..35117f7f --- /dev/null +++ b/result/schematron/zvon11_2.err @@ -0,0 +1,3 @@ +Pattern: Attributes present +/AAA/BBB line 2: The element must not have an isolated aaa attribute +./test/schematron/zvon11_2.xml fails to validate diff --git a/result/schematron/zvon11_3 b/result/schematron/zvon11_3 new file mode 100644 index 00000000..9aae4b1e --- /dev/null +++ b/result/schematron/zvon11_3 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon11_3.err b/result/schematron/zvon11_3.err new file mode 100644 index 00000000..18517e58 --- /dev/null +++ b/result/schematron/zvon11_3.err @@ -0,0 +1,2 @@ +Pattern: Attributes present +./test/schematron/zvon11_3.xml validates diff --git a/result/schematron/zvon12_0 b/result/schematron/zvon12_0 new file mode 100644 index 00000000..72208046 --- /dev/null +++ b/result/schematron/zvon12_0 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon12_0.err b/result/schematron/zvon12_0.err new file mode 100644 index 00000000..c7e9ed25 --- /dev/null +++ b/result/schematron/zvon12_0.err @@ -0,0 +1,3 @@ +Pattern: Number of characters in an abbreviation +/AAA/BBB line 2: There is not enough letters in the abbreviation +./test/schematron/zvon12_0.xml fails to validate diff --git a/result/schematron/zvon12_1 b/result/schematron/zvon12_1 new file mode 100644 index 00000000..362de34e --- /dev/null +++ b/result/schematron/zvon12_1 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon12_1.err b/result/schematron/zvon12_1.err new file mode 100644 index 00000000..486c0bea --- /dev/null +++ b/result/schematron/zvon12_1.err @@ -0,0 +1,2 @@ +Pattern: Number of characters in an abbreviation +./test/schematron/zvon12_1.xml validates diff --git a/result/schematron/zvon12_2 b/result/schematron/zvon12_2 new file mode 100644 index 00000000..bbbf7c7f --- /dev/null +++ b/result/schematron/zvon12_2 @@ -0,0 +1,4 @@ + + + + diff --git a/result/schematron/zvon12_2.err b/result/schematron/zvon12_2.err new file mode 100644 index 00000000..5edaf307 --- /dev/null +++ b/result/schematron/zvon12_2.err @@ -0,0 +1,3 @@ +Pattern: Number of characters in an abbreviation +/AAA/BBB line 2: There is too much letters in the abbreviation +./test/schematron/zvon12_2.xml fails to validate diff --git a/result/schematron/zvon13_0 b/result/schematron/zvon13_0 new file mode 100644 index 00000000..e1295c37 --- /dev/null +++ b/result/schematron/zvon13_0 @@ -0,0 +1,7 @@ + + + 20 + 30 + 10 + 50 + diff --git a/result/schematron/zvon13_0.err b/result/schematron/zvon13_0.err new file mode 100644 index 00000000..ed98cb3d --- /dev/null +++ b/result/schematron/zvon13_0.err @@ -0,0 +1,3 @@ +Pattern: Sum equals 100%. +/Total line 1: The values do not sum to 100%. +./test/schematron/zvon13_0.xml fails to validate diff --git a/result/schematron/zvon13_1 b/result/schematron/zvon13_1 new file mode 100644 index 00000000..401e919b --- /dev/null +++ b/result/schematron/zvon13_1 @@ -0,0 +1,6 @@ + + + 20 + 10 + 50 + diff --git a/result/schematron/zvon13_1.err b/result/schematron/zvon13_1.err new file mode 100644 index 00000000..e0f02c2a --- /dev/null +++ b/result/schematron/zvon13_1.err @@ -0,0 +1,3 @@ +Pattern: Sum equals 100%. +/Total line 1: The values do not sum to 100%. +./test/schematron/zvon13_1.xml fails to validate diff --git a/result/schematron/zvon13_2 b/result/schematron/zvon13_2 new file mode 100644 index 00000000..cb1df2ed --- /dev/null +++ b/result/schematron/zvon13_2 @@ -0,0 +1,6 @@ + + + 20 + 30 + 50 + diff --git a/result/schematron/zvon13_2.err b/result/schematron/zvon13_2.err new file mode 100644 index 00000000..dfab61f9 --- /dev/null +++ b/result/schematron/zvon13_2.err @@ -0,0 +1,2 @@ +Pattern: Sum equals 100%. +./test/schematron/zvon13_2.xml validates diff --git a/result/schematron/zvon14_0 b/result/schematron/zvon14_0 new file mode 100644 index 00000000..c72e0c28 --- /dev/null +++ b/result/schematron/zvon14_0 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/result/schematron/zvon14_0.err b/result/schematron/zvon14_0.err new file mode 100644 index 00000000..60155da7 --- /dev/null +++ b/result/schematron/zvon14_0.err @@ -0,0 +1,4 @@ +Pattern: a child of selected elements +/AAA/CCC line 5: Element CCC must not be a child of element AAA +/AAA/DDD/EEE/CCC line 9: Element CCC must not be a child of element EEE +./test/schematron/zvon14_0.xml fails to validate diff --git a/result/schematron/zvon15_0 b/result/schematron/zvon15_0 new file mode 100644 index 00000000..56500fe8 --- /dev/null +++ b/result/schematron/zvon15_0 @@ -0,0 +1,5 @@ + + + + + diff --git a/result/schematron/zvon15_0.err b/result/schematron/zvon15_0.err new file mode 100644 index 00000000..52348897 --- /dev/null +++ b/result/schematron/zvon15_0.err @@ -0,0 +1,4 @@ +Pattern: id is the only permited attribute name +/AAA line 1: Attribute name is forbidden in element AAA +/AAA/CCC line 3: Attribute color is forbidden in element CCC +./test/schematron/zvon15_0.xml fails to validate diff --git a/result/schematron/zvon4_0 b/result/schematron/zvon4_0 new file mode 100644 index 00000000..b1e694e5 --- /dev/null +++ b/result/schematron/zvon4_0 @@ -0,0 +1,7 @@ + + + + + + + diff --git a/result/schematron/zvon4_0.err b/result/schematron/zvon4_0.err new file mode 100644 index 00000000..6aa6b2b5 --- /dev/null +++ b/result/schematron/zvon4_0.err @@ -0,0 +1,3 @@ +Pattern: Root test +/AAA line 1: Root element is AAA +./test/schematron/zvon4_0.xml fails to validate diff --git a/result/schematron/zvon4_1 b/result/schematron/zvon4_1 new file mode 100644 index 00000000..6b1facc6 --- /dev/null +++ b/result/schematron/zvon4_1 @@ -0,0 +1,7 @@ + + + + + + + diff --git a/result/schematron/zvon4_1.err b/result/schematron/zvon4_1.err new file mode 100644 index 00000000..4ad324f9 --- /dev/null +++ b/result/schematron/zvon4_1.err @@ -0,0 +1,3 @@ +Pattern: Root test +/XXX line 1: Root element is XXX, not AAA +./test/schematron/zvon4_1.xml fails to validate diff --git a/result/schematron/zvon5_0 b/result/schematron/zvon5_0 new file mode 100644 index 00000000..d763505b --- /dev/null +++ b/result/schematron/zvon5_0 @@ -0,0 +1,6 @@ + + + + + + diff --git a/result/schematron/zvon5_0.err b/result/schematron/zvon5_0.err new file mode 100644 index 00000000..91ef5f28 --- /dev/null +++ b/result/schematron/zvon5_0.err @@ -0,0 +1,7 @@ +Pattern: Select empty elements CCC +/AAA/BBB/CCC line 3: Source contains an empty element CCC +/AAA/BBB/CCC line 3: [1]An element CCC does not contain any text +/AAA/BBB/CCC line 3: [2]An element CCC does not contain any text +/AAA/BBB/CCC line 3: [1]An element CCC does not contain any child element +/AAA/BBB/CCC line 3: [2]An element CCC does not contain any child element +./test/schematron/zvon5_0.xml fails to validate diff --git a/result/schematron/zvon5_1 b/result/schematron/zvon5_1 new file mode 100644 index 00000000..c76b7562 --- /dev/null +++ b/result/schematron/zvon5_1 @@ -0,0 +1,6 @@ + + + + I am CCC element + + diff --git a/result/schematron/zvon5_1.err b/result/schematron/zvon5_1.err new file mode 100644 index 00000000..f4ce6d41 --- /dev/null +++ b/result/schematron/zvon5_1.err @@ -0,0 +1,5 @@ +Pattern: Select empty elements CCC +/AAA/BBB/CCC line 3: Source contains an empty element CCC +/AAA/BBB/CCC line 3: [1]An element CCC does not contain any child element +/AAA/BBB/CCC line 3: [2]An element CCC does not contain any child element +./test/schematron/zvon5_1.xml fails to validate diff --git a/result/schematron/zvon5_2 b/result/schematron/zvon5_2 new file mode 100644 index 00000000..ddc11fe3 --- /dev/null +++ b/result/schematron/zvon5_2 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/result/schematron/zvon5_2.err b/result/schematron/zvon5_2.err new file mode 100644 index 00000000..8c69e79f --- /dev/null +++ b/result/schematron/zvon5_2.err @@ -0,0 +1,5 @@ +Pattern: Select empty elements CCC +/AAA/BBB/CCC line 3: Source contains an empty element CCC +/AAA/BBB/CCC line 3: [1]An element CCC does not contain any text +/AAA/BBB/CCC line 3: [2]An element CCC does not contain any text +./test/schematron/zvon5_2.xml fails to validate diff --git a/result/schematron/zvon6_0 b/result/schematron/zvon6_0 new file mode 100644 index 00000000..65397651 --- /dev/null +++ b/result/schematron/zvon6_0 @@ -0,0 +1,4 @@ + + +aaa + diff --git a/result/schematron/zvon6_0.err b/result/schematron/zvon6_0.err new file mode 100644 index 00000000..5cc3b372 --- /dev/null +++ b/result/schematron/zvon6_0.err @@ -0,0 +1,3 @@ +Pattern: Predefined values +/AAA line 1: O.K. +./test/schematron/zvon6_0.xml fails to validate diff --git a/result/schematron/zvon6_1 b/result/schematron/zvon6_1 new file mode 100644 index 00000000..e0c2e73c --- /dev/null +++ b/result/schematron/zvon6_1 @@ -0,0 +1,4 @@ + + + bbb + diff --git a/result/schematron/zvon6_1.err b/result/schematron/zvon6_1.err new file mode 100644 index 00000000..8b728d41 --- /dev/null +++ b/result/schematron/zvon6_1.err @@ -0,0 +1,3 @@ +Pattern: Predefined values +/AAA line 1: O.K. +./test/schematron/zvon6_1.xml fails to validate diff --git a/result/schematron/zvon6_2 b/result/schematron/zvon6_2 new file mode 100644 index 00000000..edc24a97 --- /dev/null +++ b/result/schematron/zvon6_2 @@ -0,0 +1,4 @@ + + + ccc + diff --git a/result/schematron/zvon6_2.err b/result/schematron/zvon6_2.err new file mode 100644 index 00000000..18689342 --- /dev/null +++ b/result/schematron/zvon6_2.err @@ -0,0 +1,3 @@ +Pattern: Predefined values +/AAA line 1: The AAA value is not permitted. +./test/schematron/zvon6_2.xml fails to validate diff --git a/result/schematron/zvon7_0 b/result/schematron/zvon7_0 new file mode 100644 index 00000000..65397651 --- /dev/null +++ b/result/schematron/zvon7_0 @@ -0,0 +1,4 @@ + + +aaa + diff --git a/result/schematron/zvon7_0.err b/result/schematron/zvon7_0.err new file mode 100644 index 00000000..df427d68 --- /dev/null +++ b/result/schematron/zvon7_0.err @@ -0,0 +1,3 @@ +Pattern: Test integer +/AAA line 1: The AAA value is not an integer. +./test/schematron/zvon7_0.xml fails to validate diff --git a/result/schematron/zvon7_1 b/result/schematron/zvon7_1 new file mode 100644 index 00000000..0a4007ac --- /dev/null +++ b/result/schematron/zvon7_1 @@ -0,0 +1,4 @@ + + + 12.234 + diff --git a/result/schematron/zvon7_1.err b/result/schematron/zvon7_1.err new file mode 100644 index 00000000..aa1e0a15 --- /dev/null +++ b/result/schematron/zvon7_1.err @@ -0,0 +1,3 @@ +Pattern: Test integer +/AAA line 1: The AAA value is not an integer. +./test/schematron/zvon7_1.xml fails to validate diff --git a/result/schematron/zvon7_2 b/result/schematron/zvon7_2 new file mode 100644 index 00000000..8eb45e30 --- /dev/null +++ b/result/schematron/zvon7_2 @@ -0,0 +1,4 @@ + + +45 + diff --git a/result/schematron/zvon7_2.err b/result/schematron/zvon7_2.err new file mode 100644 index 00000000..abf8cc7e --- /dev/null +++ b/result/schematron/zvon7_2.err @@ -0,0 +1,3 @@ +Pattern: Test integer +/AAA line 1: O.K. +./test/schematron/zvon7_2.xml fails to validate diff --git a/result/schematron/zvon7_3 b/result/schematron/zvon7_3 new file mode 100644 index 00000000..35089dd2 --- /dev/null +++ b/result/schematron/zvon7_3 @@ -0,0 +1,4 @@ + + +0 + diff --git a/result/schematron/zvon7_3.err b/result/schematron/zvon7_3.err new file mode 100644 index 00000000..5b4b59fe --- /dev/null +++ b/result/schematron/zvon7_3.err @@ -0,0 +1,3 @@ +Pattern: Test integer +/AAA line 1: O.K. +./test/schematron/zvon7_3.xml fails to validate diff --git a/result/schematron/zvon7_4 b/result/schematron/zvon7_4 new file mode 100644 index 00000000..0739eb4d --- /dev/null +++ b/result/schematron/zvon7_4 @@ -0,0 +1,4 @@ + + +-45 + diff --git a/result/schematron/zvon7_4.err b/result/schematron/zvon7_4.err new file mode 100644 index 00000000..de1ee894 --- /dev/null +++ b/result/schematron/zvon7_4.err @@ -0,0 +1,3 @@ +Pattern: Test integer +/AAA line 1: O.K. +./test/schematron/zvon7_4.xml fails to validate diff --git a/result/schematron/zvon8_0 b/result/schematron/zvon8_0 new file mode 100644 index 00000000..1932cd04 --- /dev/null +++ b/result/schematron/zvon8_0 @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/result/schematron/zvon8_0.err b/result/schematron/zvon8_0.err new file mode 100644 index 00000000..085e1dee --- /dev/null +++ b/result/schematron/zvon8_0.err @@ -0,0 +1,3 @@ +Pattern: Test count +/XXX line 1: O.K. +./test/schematron/zvon8_0.xml fails to validate diff --git a/result/schematron/zvon8_1 b/result/schematron/zvon8_1 new file mode 100644 index 00000000..93e5cfdf --- /dev/null +++ b/result/schematron/zvon8_1 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/result/schematron/zvon8_1.err b/result/schematron/zvon8_1.err new file mode 100644 index 00000000..ae07d059 --- /dev/null +++ b/result/schematron/zvon8_1.err @@ -0,0 +1,3 @@ +Pattern: Test count +/XXX line 1: Some BBB are missing +./test/schematron/zvon8_1.xml fails to validate diff --git a/result/schematron/zvon8_2 b/result/schematron/zvon8_2 new file mode 100644 index 00000000..4eea77ba --- /dev/null +++ b/result/schematron/zvon8_2 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/result/schematron/zvon8_2.err b/result/schematron/zvon8_2.err new file mode 100644 index 00000000..37e8432c --- /dev/null +++ b/result/schematron/zvon8_2.err @@ -0,0 +1,3 @@ +Pattern: Test count +/XXX line 1: Some AAA are missing +./test/schematron/zvon8_2.xml fails to validate diff --git a/result/schematron/zvon9_0 b/result/schematron/zvon9_0 new file mode 100644 index 00000000..1f254ec2 --- /dev/null +++ b/result/schematron/zvon9_0 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/result/schematron/zvon9_0.err b/result/schematron/zvon9_0.err new file mode 100644 index 00000000..a39ceebe --- /dev/null +++ b/result/schematron/zvon9_0.err @@ -0,0 +1,2 @@ +Pattern: Test attribute +./test/schematron/zvon9_0.xml validates diff --git a/result/schematron/zvon9_1 b/result/schematron/zvon9_1 new file mode 100644 index 00000000..0dc0df72 --- /dev/null +++ b/result/schematron/zvon9_1 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/result/schematron/zvon9_1.err b/result/schematron/zvon9_1.err new file mode 100644 index 00000000..44c6f67f --- /dev/null +++ b/result/schematron/zvon9_1.err @@ -0,0 +1,3 @@ +Pattern: Test attribute +/AAA/CCC[1] line 2: Attribute id is used in wrong context +./test/schematron/zvon9_1.xml fails to validate diff --git a/result/schematron/zvon9_2 b/result/schematron/zvon9_2 new file mode 100644 index 00000000..b9218fc9 --- /dev/null +++ b/result/schematron/zvon9_2 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/result/schematron/zvon9_2.err b/result/schematron/zvon9_2.err new file mode 100644 index 00000000..20b08844 --- /dev/null +++ b/result/schematron/zvon9_2.err @@ -0,0 +1,3 @@ +Pattern: Test attribute +/AAA/BBB/CCC line 5: Attribute id is missing +./test/schematron/zvon9_2.xml fails to validate diff --git a/schematron.c b/schematron.c index b5c66181..67f97b66 100644 --- a/schematron.c +++ b/schematron.c @@ -1224,6 +1224,29 @@ exit: * * ************************************************************************/ +static xmlNodePtr +xmlSchematronGetNode(xmlSchematronValidCtxtPtr ctxt, + xmlNodePtr cur, const xmlChar *xpath) { + xmlNodePtr node = NULL; + xmlXPathObjectPtr ret; + + if ((ctxt == NULL) || (cur == NULL) || (xpath == NULL)) + return(NULL); + + ctxt->xctxt->doc = cur->doc; + ctxt->xctxt->node = cur; + ret = xmlXPathEval(xpath, ctxt->xctxt); + if (ret == NULL) + return(NULL); + + if ((ret->type == XPATH_NODESET) && + (ret->nodesetval != NULL) && (ret->nodesetval->nodeNr > 0)) + node = ret->nodesetval->nodeTab[0]; + + xmlXPathFreeObject(ret); + return(node); +} + /** * xmlSchematronReportOutput: * @ctxt: the validation context @@ -1255,7 +1278,7 @@ static xmlChar * xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, xmlNodePtr test, xmlNodePtr cur) { xmlChar *ret = NULL; - xmlNodePtr child; + xmlNodePtr child, node; if ((test == NULL) || (cur == NULL)) return(ret); @@ -1266,12 +1289,24 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, (child->type == XML_CDATA_SECTION_NODE)) ret = xmlStrcat(ret, child->content); else if (IS_SCHEMATRON(child, "name")) { - if ((cur->ns == NULL) || (cur->ns->prefix == NULL)) - ret = xmlStrcat(ret, cur->name); + xmlChar *path; + + path = xmlGetNoNsProp(child, BAD_CAST "path"); + + node = cur; + if (path != NULL) { + node = xmlSchematronGetNode(ctxt, cur, path); + if (node == NULL) + node = cur; + xmlFree(path); + } + + if ((node->ns == NULL) || (node->ns->prefix == NULL)) + ret = xmlStrcat(ret, node->name); else { - ret = xmlStrcat(ret, cur->ns->prefix); + ret = xmlStrcat(ret, node->ns->prefix); ret = xmlStrcat(ret, BAD_CAST ":"); - ret = xmlStrcat(ret, cur->name); + ret = xmlStrcat(ret, node->name); } } else { child = child->next; @@ -1358,7 +1393,7 @@ xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt, } else { snprintf(msg, 999, "%s line %ld: %s\n", (const char *) path, line, (const char *) report); - xmlFree(report); + xmlFree((char *) report); } xmlSchematronReportOutput(ctxt, cur, &msg[0]); if ((path != NULL) && (path != (xmlChar *) cur->name)) diff --git a/test/schematron/zvon11.sct b/test/schematron/zvon11.sct new file mode 100644 index 00000000..79b01fdf --- /dev/null +++ b/test/schematron/zvon11.sct @@ -0,0 +1,8 @@ + + + + The element must not have an isolated aaa attribute + The element must not have an isolated bbb attribute + + + diff --git a/test/schematron/zvon11_0.xml b/test/schematron/zvon11_0.xml new file mode 100644 index 00000000..f065eed2 --- /dev/null +++ b/test/schematron/zvon11_0.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon11_1.xml b/test/schematron/zvon11_1.xml new file mode 100644 index 00000000..c8899331 --- /dev/null +++ b/test/schematron/zvon11_1.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon11_2.xml b/test/schematron/zvon11_2.xml new file mode 100644 index 00000000..26e12213 --- /dev/null +++ b/test/schematron/zvon11_2.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon11_3.xml b/test/schematron/zvon11_3.xml new file mode 100644 index 00000000..d3ac3884 --- /dev/null +++ b/test/schematron/zvon11_3.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon12.sct b/test/schematron/zvon12.sct new file mode 100644 index 00000000..049b125e --- /dev/null +++ b/test/schematron/zvon12.sct @@ -0,0 +1,8 @@ + + + + There is not enough letters in the abbreviation + There is too much letters in the abbreviation + + + diff --git a/test/schematron/zvon12_0.xml b/test/schematron/zvon12_0.xml new file mode 100644 index 00000000..d5f28d53 --- /dev/null +++ b/test/schematron/zvon12_0.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon12_1.xml b/test/schematron/zvon12_1.xml new file mode 100644 index 00000000..3507f6b5 --- /dev/null +++ b/test/schematron/zvon12_1.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon12_2.xml b/test/schematron/zvon12_2.xml new file mode 100644 index 00000000..e0d81afa --- /dev/null +++ b/test/schematron/zvon12_2.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/schematron/zvon13.sct b/test/schematron/zvon13.sct new file mode 100644 index 00000000..cd433e01 --- /dev/null +++ b/test/schematron/zvon13.sct @@ -0,0 +1,7 @@ + + + + The values do not sum to 100%. + + + diff --git a/test/schematron/zvon13_0.xml b/test/schematron/zvon13_0.xml new file mode 100644 index 00000000..52619c3b --- /dev/null +++ b/test/schematron/zvon13_0.xml @@ -0,0 +1,6 @@ + + 20 + 30 + 10 + 50 + diff --git a/test/schematron/zvon13_1.xml b/test/schematron/zvon13_1.xml new file mode 100644 index 00000000..8fb73683 --- /dev/null +++ b/test/schematron/zvon13_1.xml @@ -0,0 +1,5 @@ + + 20 + 10 + 50 + diff --git a/test/schematron/zvon13_2.xml b/test/schematron/zvon13_2.xml new file mode 100644 index 00000000..af4d76ad --- /dev/null +++ b/test/schematron/zvon13_2.xml @@ -0,0 +1,5 @@ + + 20 + 30 + 50 + diff --git a/test/schematron/zvon14.sct b/test/schematron/zvon14.sct new file mode 100644 index 00000000..f98b6d89 --- /dev/null +++ b/test/schematron/zvon14.sct @@ -0,0 +1,10 @@ + + + + Element CCC must not be a child of element + + + + + + diff --git a/test/schematron/zvon14_0.xml b/test/schematron/zvon14_0.xml new file mode 100644 index 00000000..b6270436 --- /dev/null +++ b/test/schematron/zvon14_0.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/test/schematron/zvon15.sct b/test/schematron/zvon15.sct new file mode 100644 index 00000000..7da5d868 --- /dev/null +++ b/test/schematron/zvon15.sct @@ -0,0 +1,11 @@ + + + + Attribute + is forbidden in element + + + + + + diff --git a/test/schematron/zvon15_0.xml b/test/schematron/zvon15_0.xml new file mode 100644 index 00000000..390aedb5 --- /dev/null +++ b/test/schematron/zvon15_0.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/schematron/zvon4.sct b/test/schematron/zvon4.sct new file mode 100644 index 00000000..0b8a4e1b --- /dev/null +++ b/test/schematron/zvon4.sct @@ -0,0 +1,10 @@ + + + + Root element is + , not AAA + + Root element is AAA + + + diff --git a/test/schematron/zvon4_0.xml b/test/schematron/zvon4_0.xml new file mode 100644 index 00000000..4ba332e4 --- /dev/null +++ b/test/schematron/zvon4_0.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/schematron/zvon4_1.xml b/test/schematron/zvon4_1.xml new file mode 100644 index 00000000..5becbcf6 --- /dev/null +++ b/test/schematron/zvon4_1.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/schematron/zvon5.sct b/test/schematron/zvon5.sct new file mode 100644 index 00000000..36cb8bb1 --- /dev/null +++ b/test/schematron/zvon5.sct @@ -0,0 +1,12 @@ + + + + Source contains an empty element CCC + [1]An element CCC does not contain any text + [2]An element CCC does not contain any text + [1]An element CCC does not contain any child element + [2]An element CCC does not contain any child element + + + + diff --git a/test/schematron/zvon5_0.xml b/test/schematron/zvon5_0.xml new file mode 100644 index 00000000..dc7c36ba --- /dev/null +++ b/test/schematron/zvon5_0.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/schematron/zvon5_1.xml b/test/schematron/zvon5_1.xml new file mode 100644 index 00000000..6915fa63 --- /dev/null +++ b/test/schematron/zvon5_1.xml @@ -0,0 +1,5 @@ + + + I am CCC element + + diff --git a/test/schematron/zvon5_2.xml b/test/schematron/zvon5_2.xml new file mode 100644 index 00000000..2a114004 --- /dev/null +++ b/test/schematron/zvon5_2.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/schematron/zvon6.sct b/test/schematron/zvon6.sct new file mode 100644 index 00000000..678ae580 --- /dev/null +++ b/test/schematron/zvon6.sct @@ -0,0 +1,8 @@ + + + + O.K. + The AAA value is not permitted. + + + diff --git a/test/schematron/zvon6_0.xml b/test/schematron/zvon6_0.xml new file mode 100644 index 00000000..a3efb701 --- /dev/null +++ b/test/schematron/zvon6_0.xml @@ -0,0 +1,3 @@ + +aaa + diff --git a/test/schematron/zvon6_1.xml b/test/schematron/zvon6_1.xml new file mode 100644 index 00000000..7d7daf86 --- /dev/null +++ b/test/schematron/zvon6_1.xml @@ -0,0 +1,3 @@ + + bbb + diff --git a/test/schematron/zvon6_2.xml b/test/schematron/zvon6_2.xml new file mode 100644 index 00000000..555f24d4 --- /dev/null +++ b/test/schematron/zvon6_2.xml @@ -0,0 +1,3 @@ + + ccc + diff --git a/test/schematron/zvon7.sct b/test/schematron/zvon7.sct new file mode 100644 index 00000000..a22a89ed --- /dev/null +++ b/test/schematron/zvon7.sct @@ -0,0 +1,9 @@ + + + + O.K. + The AAA value is not an integer. + + + + diff --git a/test/schematron/zvon7_0.xml b/test/schematron/zvon7_0.xml new file mode 100644 index 00000000..a3efb701 --- /dev/null +++ b/test/schematron/zvon7_0.xml @@ -0,0 +1,3 @@ + +aaa + diff --git a/test/schematron/zvon7_1.xml b/test/schematron/zvon7_1.xml new file mode 100644 index 00000000..8da0ae59 --- /dev/null +++ b/test/schematron/zvon7_1.xml @@ -0,0 +1,3 @@ + + 12.234 + diff --git a/test/schematron/zvon7_2.xml b/test/schematron/zvon7_2.xml new file mode 100644 index 00000000..e27cfe78 --- /dev/null +++ b/test/schematron/zvon7_2.xml @@ -0,0 +1,3 @@ + +45 + diff --git a/test/schematron/zvon7_3.xml b/test/schematron/zvon7_3.xml new file mode 100644 index 00000000..c17295af --- /dev/null +++ b/test/schematron/zvon7_3.xml @@ -0,0 +1,3 @@ + +0 + diff --git a/test/schematron/zvon7_4.xml b/test/schematron/zvon7_4.xml new file mode 100644 index 00000000..4f34fbea --- /dev/null +++ b/test/schematron/zvon7_4.xml @@ -0,0 +1,3 @@ + +-45 + diff --git a/test/schematron/zvon8.sct b/test/schematron/zvon8.sct new file mode 100644 index 00000000..5641ecdb --- /dev/null +++ b/test/schematron/zvon8.sct @@ -0,0 +1,10 @@ + + + + O.K. + Some AAA are missing + Some BBB are missing + + + + diff --git a/test/schematron/zvon8_0.xml b/test/schematron/zvon8_0.xml new file mode 100644 index 00000000..b6739bb4 --- /dev/null +++ b/test/schematron/zvon8_0.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/schematron/zvon8_1.xml b/test/schematron/zvon8_1.xml new file mode 100644 index 00000000..196dbe25 --- /dev/null +++ b/test/schematron/zvon8_1.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/schematron/zvon8_2.xml b/test/schematron/zvon8_2.xml new file mode 100644 index 00000000..f85de825 --- /dev/null +++ b/test/schematron/zvon8_2.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/schematron/zvon9.sct b/test/schematron/zvon9.sct new file mode 100644 index 00000000..6f67877f --- /dev/null +++ b/test/schematron/zvon9.sct @@ -0,0 +1,9 @@ + + + + Attribute id is missing + Attribute id is used in wrong context + + + + diff --git a/test/schematron/zvon9_0.xml b/test/schematron/zvon9_0.xml new file mode 100644 index 00000000..d8715192 --- /dev/null +++ b/test/schematron/zvon9_0.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/schematron/zvon9_1.xml b/test/schematron/zvon9_1.xml new file mode 100644 index 00000000..5c1c1bf0 --- /dev/null +++ b/test/schematron/zvon9_1.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/schematron/zvon9_2.xml b/test/schematron/zvon9_2.xml new file mode 100644 index 00000000..7e09fab8 --- /dev/null +++ b/test/schematron/zvon9_2.xml @@ -0,0 +1,7 @@ + + + + + + +