Skip to content

Commit

Permalink
Fix syntax ambiguity in patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed Nov 9, 2024
1 parent 72a15a9 commit 2f8a8c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 2 additions & 5 deletions specifications/grammar-40/xpath-grammar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,8 @@ apply.
</g:choice>
</g:production>

<g:production name="RootedPath" if="xslt40-patterns">
<g:choice name="VarOrFunctionCall">
<g:ref name="VarRef"/>
<g:ref name="FunctionCallP"/>
</g:choice>
<g:production name="RootedPath" if="xslt40-patterns">
<g:ref name="VarRef"/>
<g:zeroOrMore>
<g:ref name="Predicate"/>
</g:zeroOrMore>
Expand Down
9 changes: 5 additions & 4 deletions specifications/xslt-40/src/xslt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10777,14 +10777,15 @@ and <code>version="1.0"</code> otherwise.</p>
</ulist>


<p>More formally, an item <var>$J</var> matches a pattern <code>type(T)[P1][P2][P3]</code> if
the XPath expression <code>$J instance of T and exists($J[P1][P2]P3])</code> is true.</p>
<p>More formally, an item <var>$J</var> matches a pattern <code>type(<var>T</var>)[<var>P1</var>][<var>P2</var>][<var>P3</var>]</code> if
the XPath expression <code>$J instance of <var>T</var> and exists($J[<var>P1</var>][<var>P2</var>][<var>P3</var>])</code> is true.</p>

<note><p>As with predicate patterns, numeric predicates are allowed, but serve no useful purpose.</p></note>



<p>A pattern written as <code>record(A, B, C)</code> is an abbreviation for <code>type(record(A, B, C))</code>
<p>A pattern written as <code>record(<var>A</var>, <var>B</var>, <var>C</var>)</code>
is an abbreviation for <code>type(record(<var>A</var>, <var>B</var>, <var>C</var>))</code>
(retaining any predicates). For example, the pattern <code>record(first, last, *)[?first eq "Sharon"]</code>
matches any map having entries with the string-valued keys <code>"first"</code> and <code>"last"</code>,
where the entry for the key <code>"first"</code> is equal to the string <code>"Sharon"</code>.</p>
Expand All @@ -10805,7 +10806,7 @@ and <code>version="1.0"</code> otherwise.</p>
<head>Node Patterns</head>

<changes>
<change issue="1375">
<change issue="1375 1522" PR="1378" date="2024-10-15">
A function call at the outermost level can now be named using any valid <code>EQName</code>
(for example <code>fn:doc</code>) provided it binds to one of the permitted functions
<xfunction>fn:doc</xfunction>, <xfunction>fn:id</xfunction>, <xfunction>fn:element-with-id</xfunction>,
Expand Down

0 comments on commit 2f8a8c1

Please sign in to comment.