From 75e5d0315a40d5b7d7c8e13c65c29fee656fe082 Mon Sep 17 00:00:00 2001 From: galtm <40716346+galtm@users.noreply.github.com> Date: Wed, 8 May 2024 14:52:20 -0400 Subject: [PATCH] Sample code for "Comparing Attributes Selectively in XSpec 3.0" --- README.md | 3 +- src/three-dots-attrs/README.md | 15 +++ .../three-dots-attrs-prefix-variant-xq.xspec | 119 ++++++++++++++++++ .../three-dots-attrs-sch.xspec | 30 +++++ .../three-dots-attrs-xq.xspec | 102 +++++++++++++++ src/three-dots-attrs/three-dots-attrs.sch | 30 +++++ src/three-dots-attrs/three-dots-attrs.xqm | 29 +++++ 7 files changed, 327 insertions(+), 1 deletion(-) create mode 100644 src/three-dots-attrs/README.md create mode 100644 src/three-dots-attrs/three-dots-attrs-prefix-variant-xq.xspec create mode 100644 src/three-dots-attrs/three-dots-attrs-sch.xspec create mode 100644 src/three-dots-attrs/three-dots-attrs-xq.xspec create mode 100644 src/three-dots-attrs/three-dots-attrs.sch create mode 100644 src/three-dots-attrs/three-dots-attrs.xqm diff --git a/README.md b/README.md index 9054066..e8d84ef 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Each post corresponds to a [subfolder under `src/`](https://github.com/galtm/xsp * [But the Diffs Look the Same](https://github.com/galtm/xspectacles/tree/main/src/identical-diffs) * [Code Reuse at the File Level in XSpec](https://github.com/galtm/xspectacles/tree/main/src/code-reuse-file-level) * [Code Reuse in XSpec: How to Use x:like](https://github.com/galtm/xspectacles/tree/main/src/code-reuse) +* **(NEW!)** [Comparing Attributes Selectively in XSpec 3.0](https://github.com/galtm/xspectacles/tree/main/src/three-dots-attrs) * [Content Outside the Selection in XSpec](https://github.com/galtm/xspectacles/tree/main/src/out-of-scope) * [Fixing Surprise Spaces in XSpec Actual Result](https://github.com/galtm/xspectacles/tree/main/src/space-actual) * [Inheritance as a Form of Reuse in XSpec](https://github.com/galtm/xspectacles/tree/main/src/code-reuse-call) @@ -20,7 +21,7 @@ Each post corresponds to a [subfolder under `src/`](https://github.com/galtm/xsp * [Saying "Not Yet" in XSpec](https://github.com/galtm/xspectacles/tree/main/src/pending) * [Saying "Whatever" in XSpec: How, Why, When](https://github.com/galtm/xspectacles/tree/main/src/three-dots) * [Testing a Thin-Wrapper XSLT Template Without Excessive Repetition](https://github.com/galtm/xspectacles/tree/main/src/similar-code-wrapper) -* **(NEW!)** [Testing an XPath Function Library with XSpec 3.0](https://github.com/galtm/xspectacles/tree/main/src/xpath-function-library) +* [Testing an XPath Function Library with XSpec 3.0](https://github.com/galtm/xspectacles/tree/main/src/xpath-function-library) * [Testing Boolean-Valued Functions: An XSpec Blooper with Easy Fixes](https://github.com/galtm/xspectacles/tree/main/src/boolean-fcn) * [Testing Explicit Whitespace in XSpec](https://github.com/galtm/xspectacles/tree/main/src/space-explicit) * [Testing Schematron Messages with XSpec 3.0](https://github.com/galtm/xspectacles/tree/main/src/schematron-messages) diff --git a/src/three-dots-attrs/README.md b/src/three-dots-attrs/README.md new file mode 100644 index 0000000..42c3aa8 --- /dev/null +++ b/src/three-dots-attrs/README.md @@ -0,0 +1,15 @@ +# Sample code for "Comparing Attributes Selectively in XSpec 3.0" + +Example files for "Example Comparing Attributes in Stages": + +* `three-dots-attrs.xqm` +* `three-dots-attrs-xq.xspec` +* `three-dots-attrs-prefix-variant-xq.xspec` + +Example files for "Example Skipping Comparison of Schematron SVRL Attributes": + +* `three-dots-attrs.sch` +* `three-dots-attrs-sch.xspec` + +#### Link to Topic +[Comparing Attributes Selectively in XSpec 3.0](https://medium.com/@xspectacles/comparing-attributes-selectively-in-xspec-3-0-f3a457fe8e04) diff --git a/src/three-dots-attrs/three-dots-attrs-prefix-variant-xq.xspec b/src/three-dots-attrs/three-dots-attrs-prefix-variant-xq.xspec new file mode 100644 index 0000000..67a5112 --- /dev/null +++ b/src/three-dots-attrs/three-dots-attrs-prefix-variant-xq.xspec @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Heading Content + + + Heading Content + + + Heading Content + + + + + + diff --git a/src/three-dots-attrs/three-dots-attrs-sch.xspec b/src/three-dots-attrs/three-dots-attrs-sch.xspec new file mode 100644 index 0000000..a95f1a3 --- /dev/null +++ b/src/three-dots-attrs/three-dots-attrs-sch.xspec @@ -0,0 +1,30 @@ + + + + + + phase1 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/three-dots-attrs/three-dots-attrs-xq.xspec b/src/three-dots-attrs/three-dots-attrs-xq.xspec new file mode 100644 index 0000000..14910fa --- /dev/null +++ b/src/three-dots-attrs/three-dots-attrs-xq.xspec @@ -0,0 +1,102 @@ + + + + + + + + + + img element with class, src, onclick, + and data attributes representing ship ID, + weapons, shields, and coordinates + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Heading Content + + +

Heading Content

+
+ +

Heading Content

+
+
+ +
+ + diff --git a/src/three-dots-attrs/three-dots-attrs.sch b/src/three-dots-attrs/three-dots-attrs.sch new file mode 100644 index 0000000..0630441 --- /dev/null +++ b/src/three-dots-attrs/three-dots-attrs.sch @@ -0,0 +1,30 @@ + + + + + + + + + + + + glossdef must have text + + + + + + + + + + + + \ No newline at end of file diff --git a/src/three-dots-attrs/three-dots-attrs.xqm b/src/three-dots-attrs/three-dots-attrs.xqm new file mode 100644 index 0000000..e785426 --- /dev/null +++ b/src/three-dots-attrs/three-dots-attrs.xqm @@ -0,0 +1,29 @@ +xquery version "3.1"; +module namespace my-xq = "x-urn:my-xq"; +declare default element namespace "http://www.w3.org/1999/xhtml"; + +(: + Sample code for "Comparing Attributes Selectively in XSpec 3.0" + https://medium.com/@xspectacles/comparing-attributes-selectively-in-xspec-3-0-f3a457fe8e04 +:) + +(: + The HTML element with data attributes is taken from + https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-* +:) +declare function my-xq:spaceship-img() as element(img) { + +}; + +declare function my-xq:heading($content as node()) as element(h1) { +

{$content}

+};