Skip to content

Commit

Permalink
Fix copy and paste errors in describing type patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed Oct 10, 2023
1 parent 35a08e0 commit 75c7ec0
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions specifications/xslt-40/src/xslt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10280,20 +10280,25 @@ and <code>version="1.0"</code> otherwise.</p>
to <code>true</code>.</termdef></p>
<p>A predicate pattern <code>.[P1][P2]...</code> can be regarded as an abbreviation
for the type pattern <code>type(item())[P1][P2]...</code>.</p>
<p>The detailed semantics are given in <specref ref="predicate-patterns"/>. This construct can be used to match items of any
kind (nodes, atomic values, and function items). For example, the pattern
<code>.[starts-with(., '$')]</code> matches any string that starts with the
character <code>$</code>, or a node whose atomized value starts with
<code>$</code>. This example shows a predicate pattern with a single
predicate, but the grammar allows any number of predicates (zero or more).</p>
</item>
<item>
<p><termdef id="dt-type-pattern" term="type pattern">A <term>type pattern</term> can be written as
<code>type(T)</code> (where <var>T</var> is an <xnt spec="XP40" ref="prod-xpath40-ItemType">ItemType</xnt>
followed by zero or more predicates in square
brackets, and it matches any item of type <var>T</var> which each of the predicates evaluates
to <code>true</code>.</termdef></p>
<p>For convenience, if <var>T</var> takes the form <code>record(F1, F2, ...)</code>, then the pattern can be abbrevated.</p>
<p>The detailed semantics are given in <specref ref="pattern-semantics"/>. This construct can be used to match items of any
kind (nodes, atomic values, and function items). For example, the pattern
<code>.[starts-with(., '$')]</code> matches any string that starts with the
character <code>$</code>, or a node whose atomized value starts with
<code>$</code>. This example shows a predicate pattern with a single
predicate, but the grammar allows any number of predicates (zero or more).</p>
<p>The most commonly used type patterns can be abbreviated. For example, <code>match="type(record(F1, F2, *))"</code>
can be abbrevated to <code>match="record(F1, F2, *)"</code>, and <code>match="type(array(xs:string))"</code>
can be abbreviated to <code>match="array(xs:string)"</code>. The main case where such abbreviation is
not possible is with atomic values: <code>match="type(xs:date)"</code> cannot be abbreviated because
a bare QName is interpreted as a node pattern, matching elements named <code>xs:date</code>.</p>

</item>
<item>
<p><termdef id="dt-node-pattern" term="node pattern">A <term>node pattern</term> uses a subset of
Expand Down Expand Up @@ -10616,12 +10621,20 @@ and <code>version="1.0"</code> otherwise.</p>
</note>

<p diff="add" at="2022-01-01">For example, the pattern <code>.[contains(., "XSLT")]</code>
matches any item whose typed value contains <code>"XSLT"</code> as a substring.
matches any item whose atomized value contains <code>"XSLT"</code> as a substring.
It matches values such as the string <code>"XSLT Transformations"</code>, the
<code>xs:anyURI</code> value
<code>http://www.w3.org/TR/XSLT</code>, the attribute node
<code>class="XSD XSLT XPath"</code>, and the singleton array <code>["XSLT 4.0"]</code>.</p>

<note diff="add" at="2023-10-10"><p>
Evaluation of this example pattern may fail with a dynamic error if the item in question
has an atomized value that is not a string, or that is a sequence of strings: an example might
be the array <code>["XSLT", 1999]</code>. It will also fail if the item cannot be atomized,
for example if it is a map. The rules in <specref ref="pattern-errors"/> cause these errors
to be masked: they simply result in the pattern being treated as non-matching.
</p></note>

</div4>

<div4 id="type-patterns" diff="add" at="2022-01-01">
Expand Down

0 comments on commit 75c7ec0

Please sign in to comment.