From 522e84e35eab9b115ad955574f3912217a153fbb Mon Sep 17 00:00:00 2001 From: Syd Bauman Date: Fri, 6 Oct 2023 21:44:50 -0400 Subject: [PATCH 1/5] Fix #631 (I hope): Generate a different RELAX NG pattern (and reference to it) for every occurence of an anyElement element, and update tests to match. (Previously we were trying to generate one for every content model in which an anyElement occurred, but were generation one for every content model in which an anyElement element occurred only once.) --- Test/expected-results/test.rng | 6 +- Test/expected-results/test15.odd.rnc | 6 +- Test/expected-results/test21.odd.rnc | 6 +- Test/expected-results/test30.rnc | 6 +- Test/expected-results/test33.rnc | 6 +- Test/expected-results/test34.rnc | 6 +- Test/expected-results/test35.rnc | 6 +- Test2/expected-results/testAttValQuant.rng | 6 +- Test2/expected-results/testPure1.rng | 6 +- odds/odd2relax.xsl | 152 +++++++++++++-------- odds/teiodds.xsl | 15 +- 11 files changed, 135 insertions(+), 86 deletions(-) diff --git a/Test/expected-results/test.rng b/Test/expected-results/test.rng index e2a2bd35c..f116905e0 100644 --- a/Test/expected-results/test.rng +++ b/Test/expected-results/test.rng @@ -68,7 +68,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -7277,7 +7277,7 @@ Suggested values include: 1] sent; 2] received; 3] transmitted; 4] redirected; 5 (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] - + diff --git a/Test/expected-results/test15.odd.rnc b/Test/expected-results/test15.odd.rnc index 5d8dbe21e..a2844a2ba 100644 --- a/Test/expected-results/test15.odd.rnc +++ b/Test/expected-results/test15.odd.rnc @@ -24,10 +24,10 @@ macro.specialPara = | model.inter | model.divPart | model.global)* -anyElement-xenoData = +anyElement_xenoData_1 = element * - (tei:* | teix:egXML) { attribute * { text }*, - (text | anyElement-xenoData)* + (text | anyElement_xenoData_1)* } att.anchoring.attributes = att.anchoring.attribute.anchored, att.anchoring.attribute.targetEnd @@ -4589,7 +4589,7 @@ xenoData = ## (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] element xenoData { - (text | anyElement-xenoData), + (text | anyElement_xenoData_1), att.global.attributes, att.declarable.attributes, att.typed.attributes, diff --git a/Test/expected-results/test21.odd.rnc b/Test/expected-results/test21.odd.rnc index 33cd31fbd..22a44fbb8 100644 --- a/Test/expected-results/test21.odd.rnc +++ b/Test/expected-results/test21.odd.rnc @@ -25,10 +25,10 @@ macro.specialPara = | model.divPart | model.global)* macro.xtext = (text | model.gLike)* -anyElement-xenoData = +anyElement_xenoData_1 = element * - (tei:* | teix:egXML) { attribute * { text }*, - (text | anyElement-xenoData)* + (text | anyElement_xenoData_1)* } att.anchoring.attributes = att.anchoring.attribute.anchored, att.anchoring.attribute.targetEnd @@ -6428,7 +6428,7 @@ xenoData = ## (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] element xenoData { - (text | anyElement-xenoData), + (text | anyElement_xenoData_1), att.global.attributes, att.declarable.attributes, att.typed.attributes, diff --git a/Test/expected-results/test30.rnc b/Test/expected-results/test30.rnc index 0af31fc7c..d323bc7bd 100644 --- a/Test/expected-results/test30.rnc +++ b/Test/expected-results/test30.rnc @@ -27,10 +27,10 @@ Tmacro.specialPara = | Tmodel.divPart | Tmodel.global)* Tmacro.xtext = (text | Tmodel.gLike)* -anyElement-xenoData = +anyElement_xenoData_1 = element * - (tei:* | ns2:* | teix:egXML) { attribute * { text }*, - (text | anyElement-xenoData)* + (text | anyElement_xenoData_1)* } Tatt.anchoring.attributes = Tatt.anchoring.attribute.anchored, Tatt.anchoring.attribute.targetEnd @@ -5061,7 +5061,7 @@ TxenoData = ## (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] element xenoData { - (text | anyElement-xenoData), + (text | anyElement_xenoData_1), Tatt.global.attributes, Tatt.declarable.attributes, Tatt.typed.attributes, diff --git a/Test/expected-results/test33.rnc b/Test/expected-results/test33.rnc index e7a452db1..7fabe7167 100644 --- a/Test/expected-results/test33.rnc +++ b/Test/expected-results/test33.rnc @@ -28,10 +28,10 @@ tei_macro.specialPara = | tei_model.inter | tei_model.divPart | tei_model.global)* -anyElement-xenoData = +anyElement_xenoData_1 = element * - (tei:* | teix:egXML) { attribute * { text }*, - (text | anyElement-xenoData)* + (text | anyElement_xenoData_1)* } tei_att.anchoring.attributes = tei_att.anchoring.attribute.anchored, @@ -4817,7 +4817,7 @@ tei_xenoData = ## (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] element tei:xenoData { - (text | anyElement-xenoData), + (text | anyElement_xenoData_1), tei_att.global.attributes, tei_att.declarable.attributes, tei_att.typed.attributes, diff --git a/Test/expected-results/test34.rnc b/Test/expected-results/test34.rnc index 2749ee8b6..56f28e374 100644 --- a/Test/expected-results/test34.rnc +++ b/Test/expected-results/test34.rnc @@ -29,10 +29,10 @@ tei_macro.specialPara = | tei_model.inter | tei_model.divPart | tei_model.global)* -anyElement-xenoData = +anyElement_xenoData_1 = element * - (tei:* | teix:egXML) { attribute * { text }*, - (text | anyElement-xenoData)* + (text | anyElement_xenoData_1)* } tei_att.anchoring.attributes = tei_att.anchoring.attribute.anchored, @@ -4820,7 +4820,7 @@ tei_xenoData = ## (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] element xenoData { - (text | anyElement-xenoData), + (text | anyElement_xenoData_1), tei_att.global.attributes, tei_att.declarable.attributes, tei_att.typed.attributes, diff --git a/Test/expected-results/test35.rnc b/Test/expected-results/test35.rnc index cfba7812e..78716f919 100644 --- a/Test/expected-results/test35.rnc +++ b/Test/expected-results/test35.rnc @@ -29,10 +29,10 @@ tei_macro.specialPara = | tei_model.inter | tei_model.divPart | tei_model.global)* -anyElement-xenoData = +anyElement_xenoData_1 = element * - (tei:* | teix:egXML) { attribute * { text }*, - (text | anyElement-xenoData)* + (text | anyElement_xenoData_1)* } tei_att.anchoring.attributes = tei_att.anchoring.attribute.anchored, @@ -4798,7 +4798,7 @@ tei_xenoData = ## (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] element tei:xenoData { - (text | anyElement-xenoData), + (text | anyElement_xenoData_1), tei_att.global.attributes, tei_att.declarable.attributes, tei_att.typed.attributes, diff --git a/Test2/expected-results/testAttValQuant.rng b/Test2/expected-results/testAttValQuant.rng index eb6be5e95..06c3c24f9 100644 --- a/Test2/expected-results/testAttValQuant.rng +++ b/Test2/expected-results/testAttValQuant.rng @@ -53,7 +53,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -6718,7 +6718,7 @@ Suggested values include: 1] sent; 2] received; 3] transmitted; 4] redirected; 5 (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] - + diff --git a/Test2/expected-results/testPure1.rng b/Test2/expected-results/testPure1.rng index 97bb0a7ec..59e5fb99a 100644 --- a/Test2/expected-results/testPure1.rng +++ b/Test2/expected-results/testPure1.rng @@ -70,7 +70,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -7019,7 +7019,7 @@ Suggested values include: 1] sent; 2] received; 3] transmitted; 4] redirected; 5 (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] - + diff --git a/odds/odd2relax.xsl b/odds/odd2relax.xsl index fc425c21a..bb23356d9 100644 --- a/odds/odd2relax.xsl +++ b/odds/odd2relax.xsl @@ -27,7 +27,7 @@ Unported License http://creativecommons.org/licenses/by-sa/3.0/ 2. http://www.opensource.org/licenses/BSD-2-Clause - + Redistribution and use in source and binary forms, with or without @@ -73,12 +73,12 @@ of this software, even if advised of the possibility of such damage. -1 dtd - + - + @@ -220,9 +220,26 @@ of this software, even if advised of the possibility of such damage. - - - + + + + + + + @@ -242,7 +259,7 @@ of this software, even if advised of the possibility of such damage. Schema generated - + @@ -299,7 +316,7 @@ of this software, even if advised of the possibility of such damage. - + @@ -309,9 +326,9 @@ of this software, even if advised of the possibility of such damage. + select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:availability"> - This material is dual-licensed. + This material is dual-licensed. @@ -327,14 +344,20 @@ of this software, even if advised of the possibility of such damage. - + - - - - - + + + + + + + + @@ -357,7 +380,10 @@ of this software, even if advised of the possibility of such damage. ' - + + + + @@ -404,8 +430,9 @@ of this software, even if advised of the possibility of such damage. - , 'http://www.tei-c.org/ns/1.0' + + , 'http://www.tei-c.org/ns/1.0' + @@ -477,38 +504,32 @@ of this software, even if advised of the possibility of such damage. + mode='pass2'> - - - + + + - + - - - - - - - + + + - + - + @@ -520,11 +541,28 @@ of this software, even if advised of the possibility of such damage. + + + + + + + + + + + + debug: pass2 has: + + + + + @@ -550,20 +588,20 @@ of this software, even if advised of the possibility of such damage. - + - - - - - - - + + + + + + + @@ -585,7 +623,7 @@ of this software, even if advised of the possibility of such damage. - + - + @@ -650,13 +688,13 @@ of this software, even if advised of the possibility of such damage. prefix --> - - - - + + + + diff --git a/odds/teiodds.xsl b/odds/teiodds.xsl index 6990b6ae7..38f5ee9d9 100644 --- a/odds/teiodds.xsl +++ b/odds/teiodds.xsl @@ -190,6 +190,13 @@ of this software, even if advised of the possibility of such damage. + + + + 0 + + + @@ -328,15 +335,19 @@ of this software, even if advised of the possibility of such damage. + + + + - + - + From e5caa3f89b3a34e606715ebf30b61ff035e2caa4 Mon Sep 17 00:00:00 2001 From: Syd Bauman Date: Fri, 6 Oct 2023 21:58:45 -0400 Subject: [PATCH 2/5] remove some debugging code --- odds/odd2relax.xsl | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/odds/odd2relax.xsl b/odds/odd2relax.xsl index bb23356d9..7233e1e30 100644 --- a/odds/odd2relax.xsl +++ b/odds/odd2relax.xsl @@ -541,22 +541,6 @@ of this software, even if advised of the possibility of such damage. - - - - - - - - - - - - debug: pass2 has: - - - - From f8f0e4491d646339cc69b885cf890cf1776508d0 Mon Sep 17 00:00:00 2001 From: Syd Bauman Date: Sat, 7 Oct 2023 20:15:04 -0400 Subject: [PATCH 3/5] Add a test with 2 elements. --- Test2/expected-results/testPure1.rng | 63 +++- Test2/inputFiles/testPure1.odd | 419 ++++++++++++++------------- 2 files changed, 271 insertions(+), 211 deletions(-) diff --git a/Test2/expected-results/testPure1.rng b/Test2/expected-results/testPure1.rng index 59e5fb99a..34ad63e53 100644 --- a/Test2/expected-results/testPure1.rng +++ b/Test2/expected-results/testPure1.rng @@ -70,7 +70,7 @@ - + @@ -86,7 +86,56 @@ - + + + + + + + address descendants must be in the + namespaces + 'https://docbook.org/ns/docbook', 'http://www.tei-c.org/ns/1.0' + + + + + + + + + egXML + + + + + + + + + + + + + + + + + + + + + egXML + + + + + + + + + + + @@ -4506,15 +4555,11 @@ Sample values include: 1] rubbing; 2] mildew; 3] smoke (address) contains a postal address, for example of a publisher, an organization, or an individual. [3.6.2. Addresses 2.2.4. Publication, Distribution, Licensing, etc. 3.12.2.4. Imprint, Size of a Document, and Reprint Information] - - - + - - - + @@ -7019,7 +7064,7 @@ Suggested values include: 1] sent; 2] received; 3] transmitted; 4] redirected; 5 (non-TEI metadata) provides a container element into which metadata in non-TEI formats may be placed. [2.5. Non-TEI Metadata] - + diff --git a/Test2/inputFiles/testPure1.odd b/Test2/inputFiles/testPure1.odd index e80d5ca43..36e135e89 100644 --- a/Test2/inputFiles/testPure1.odd +++ b/Test2/inputFiles/testPure1.odd @@ -1,33 +1,35 @@ - + + - - - Test TEI Customization using Pure ODD - Martin Holmes - Syd Bauman - - -

Free for anyone for anything

-
- -

Authored from scratch

-
-
+ + + Test TEI Customization using Pure ODD + Martin Holmes + Syd Bauman + + +

Free for anyone for anything

+
+ +

Authored from scratch

+
+
- -

Here is the TEI badge: - - The TEI Badge - . It is here to test desc in graphic in an ODD per - . -

- - This file is intended as input for a conversion to + +

Here is the TEI badge: + + The TEI Badge + . It is here to test desc in graphic in an ODD per + . +

+ + This file is intended as input for a conversion to RNG and Schematron (and possibly other outputs) as part of the modular Stylesheets test process. No source is specified here, because the source p5subset.xml is controlled @@ -39,212 +41,225 @@ compliant schemas (for the most severe definition of TEI-compliant). - - - - - + + + + + - + - + - - - + + + - - - + + + - + - - + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - long playing - 12-inch vinyl - - - - - - compact disc - - - - - - - - + + + + + + + + + long playing + 12-inch vinyl + + + + + + compact disc + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - A short bibliographic citation with nothing but author, title, and optional date - - - - - - - - - - - - - - - - - - - + + + A short bibliographic citation with nothing but author, title, and optional date + + + + + + + + + + + + + + + + + + + - - - - - - The email address of Amour de Cosmos. - - - The email address of The Venerable Bede. - - - - -

Our email element is only allowed to contain - one of two email addresses, so we try to constrain its - content model using a valList.

-
-
+ + + + + + The email address of Amour de Cosmos. + + + The email address of The Venerable Bede. + + + + +

Our email element is only allowed to contain + one of two email addresses, so we try to constrain its + content model using a valList.

+
+
- - - - - Too many links! - - - + + + + + Too many links! + + + + + + * An abbr and expan (in any order, explicitly set by @preserveOrder="false") + * A corr and sic (in that specific order, explicitly set by @preserveOrder="true") + * An orig and reg (in that specific order, implicitly set by omitting @preserveOrder) - - - - - - - - - - - - - - - - - - -

Our choice element is allowed to contain one of the following combinations: - - abbr and expan - expan and abbr - corr and sic - orig and reg - -

-
-
+ Inspired by the example in TD for sequence and alternate: + https://www.tei-c.org/Vault/P5/4.2.2/doc/tei-p5-doc/en/html/TD.html#index-egXML-d53e153603 + --> + + + + + + + + + + + + + + + + + + + +

Our choice element is allowed to contain one of the following combinations: + + abbr and expan + expan and abbr + corr and sic + orig and reg + +

+
+
-
- - + + + + + + + + + + + + + +
+ +
From a7207929f6a62b9792a06b8fe14e5b60432b59c4 Mon Sep 17 00:00:00 2001 From: Syd Bauman Date: Wed, 25 Oct 2023 20:47:46 -0400 Subject: [PATCH 4/5] Finally add comment to help future maintainers with debugging 3-pass RELAX NG pattern reduction code (which I wrote > 2 weeks ago). --- odds/odd2relax.xsl | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/odds/odd2relax.xsl b/odds/odd2relax.xsl index 7233e1e30..aedd995da 100644 --- a/odds/odd2relax.xsl +++ b/odds/odd2relax.xsl @@ -225,21 +225,18 @@ of this software, even if advised of the possibility of such damage. + - From d0661941bbb4b0fb21d1f014170ee38201651e06 Mon Sep 17 00:00:00 2001 From: helenasabel Date: Sat, 28 Oct 2023 10:28:27 +0200 Subject: [PATCH 5/5] updates id that causes tests to fail --- Test2/expected-results/testPure1.rng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test2/expected-results/testPure1.rng b/Test2/expected-results/testPure1.rng index 64fb32611..1934b7896 100644 --- a/Test2/expected-results/testPure1.rng +++ b/Test2/expected-results/testPure1.rng @@ -90,7 +90,7 @@
- + address descendants must be in the namespaces