From c35061f829fffa70737364ef3793532200f636c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 13 May 2026 18:47:14 +0200 Subject: [PATCH 1/9] adds unit test for escaping double quotes in literals This is related to #6. --- xsl/xtriples.xspec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xsl/xtriples.xspec b/xsl/xtriples.xspec index 553db82..a704780 100644 --- a/xsl/xtriples.xspec +++ b/xsl/xtriples.xspec @@ -320,4 +320,14 @@ select="'"Es ist alles eitel 2.0"'"/> + + + + + + + + + From c8f39cea2bfc7099621433a10e4f518368004199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 13 May 2026 19:44:24 +0200 Subject: [PATCH 2/9] escapes double quotes in literals, makes test for issue #6 pass --- test/quote.tei.xml | 24 ++++++++++++++++++++++++ xsl/xtriples.xsl | 13 ++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/quote.tei.xml diff --git a/test/quote.tei.xml b/test/quote.tei.xml new file mode 100644 index 0000000..4c8084f --- /dev/null +++ b/test/quote.tei.xml @@ -0,0 +1,24 @@ + + + + + + + + "Title" + + +

Publication Information

+
+ +

Information about the source

+
+
+
+ + +

Some text here.

+ +
+
diff --git a/xsl/xtriples.xsl b/xsl/xtriples.xsl index 0781a36..3e9329e 100644 --- a/xsl/xtriples.xsl +++ b/xsl/xtriples.xsl @@ -256,7 +256,13 @@ This is only a module and should be imported by some calling stylesheet. " - + + + + + + + " /concat(local-name(.), '#', @xml:id) P1_is_identified_by - /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex)=>replace('"', '"') + /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) @@ -80,7 +80,7 @@ target/bin/xslt.sh -xsl:xsl/extract-param-doc.xsl -s:recipes/tei/crm-entity-name /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) P21 - /*[$repeatIndex]=>normalize-space()=>replace('"', '"') + /*[$repeatIndex]=>normalize-space() /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) diff --git a/recipes/tei/lincs-entities.xml b/recipes/tei/lincs-entities.xml index 55b68ef..1d7f801 100644 --- a/recipes/tei/lincs-entities.xml +++ b/recipes/tei/lincs-entities.xml @@ -111,7 +111,7 @@ target/bin/xslt.sh -xsl:xsl/extract-param-doc.xsl -s:recipes/tei/lincs-entities. /concat('attributeAssignment', $resourceIndex) P3_has_note - /normalize-space(.)=>replace('"', '"') + /normalize-space(.) /concat('attributeAssignment', $resourceIndex) @@ -223,7 +223,7 @@ target/bin/xslt.sh -xsl:xsl/extract-param-doc.xsl -s:recipes/tei/lincs-entities. /concat('quote', $resourceIndex) exact - /normalize-space(.)=>replace('"', '"') + /normalize-space(.) /exists(function-lookup(xs:QName('utils:prefix'), 1)) diff --git a/recipes/tei/tei-entities.xml b/recipes/tei/tei-entities.xml index 0e6c9df..2ee5ea1 100644 --- a/recipes/tei/tei-entities.xml +++ b/recipes/tei/tei-entities.xml @@ -67,7 +67,7 @@ target/bin/xslt.sh -xsl:xsl/extract-param-doc.xsl -s:recipes/tei/crm-entity-name /concat('description_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) P21 - /*[self::tei:desc or self::tei:note][$repeatIndex]=>normalize-space()=>replace('"', '"') + /*[self::tei:desc or self::tei:note][$repeatIndex]=>normalize-space() /concat('description_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) From dc526917f77f86e7d3fcdd97155259c0eebf9a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 13 May 2026 23:05:30 +0200 Subject: [PATCH 9/9] report changes in 0.7.0 --- CHANGES.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index fb192ee..2220bf6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,14 @@ # Change Log +## 0.7.0 + +- escape double quotes, LF and CR and backslash in literals as + required by the [N-Triples specs, sec. 2.3 RDF + Literals](https://www.w3.org/TR/n-triples/#sec-literals). Escaping + must already be done by the XTriples processor, i.e. in the XSLT + stylesheet. This fixes issue #6. +- reverts escaping done in 0.6.4 from the recipes + ## 0.6.3 escape double quotes in extracted literals