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 diff --git a/recipes/tei/crm-entities.xml b/recipes/tei/crm-entities.xml index b9037a7..44c54e8 100644 --- a/recipes/tei/crm-entities.xml +++ b/recipes/tei/crm-entities.xml @@ -62,14 +62,14 @@ target/bin/xslt.sh -xsl:xsl/extract-param-doc.xsl -s:recipes/tei/crm-entity-name /$repeatIndex eq 1 /concat(local-name(.), '#', @xml:id) P48_has_preferred_identifier - /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex)=>replace('"', '"') + /concat('entityIdentifier_', local-name(.), '_', $resourceIndex, '_', $repeatIndex) /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) diff --git a/test/backslash.tei.xml b/test/backslash.tei.xml new file mode 100644 index 0000000..a903d60 --- /dev/null +++ b/test/backslash.tei.xml @@ -0,0 +1,24 @@ + + + + + + + + \Title\ + + +

Publication Information

+
+ +

Information about the source

+
+
+
+ + +

Some text here.

+ +
+
diff --git a/test/cr-lf.tei.xml b/test/cr-lf.tei.xml new file mode 100644 index 0000000..d7754d0 --- /dev/null +++ b/test/cr-lf.tei.xml @@ -0,0 +1,25 @@ + + + + + + + + Title +with new lines + + +

Publication Information

+
+ +

Information about the source

+
+
+
+ + +

Some text here.

+ +
+
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..221c9ec 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. " - + + + + + + + "