From 75c7ec0306bdc554f3d2e21ef90a4cafdc22579c Mon Sep 17 00:00:00 2001
From: Michael Kay version="1.0"
otherwise.
true
.
A predicate pattern .[P1][P2]...
can be regarded as an abbreviation
for the type pattern type(item())[P1][P2]...
.
The detailed semantics are given in .[starts-with(., '$')]
matches any string that starts with the
+ character $
, or a node whose atomized value starts with
+ $
. This example shows a predicate pattern with a single
+ predicate, but the grammar allows any number of predicates (zero or more).
version="1.0"
otherwise.
true
.
- For convenience, if T takes the form record(F1, F2, ...)
, then the pattern can be abbrevated.
The detailed semantics are given in .[starts-with(., '$')]
matches any string that starts with the
- character $
, or a node whose atomized value starts with
- $
. This example shows a predicate pattern with a single
- predicate, but the grammar allows any number of predicates (zero or more).
The most commonly used type patterns can be abbreviated. For example, match="type(record(F1, F2, *))"
+ can be abbrevated to match="record(F1, F2, *)"
, and match="type(array(xs:string))"
+ can be abbreviated to match="array(xs:string)"
. The main case where such abbreviation is
+ not possible is with atomic values: match="type(xs:date)"
cannot be abbreviated because
+ a bare QName is interpreted as a node pattern, matching elements named xs:date
.
version="1.0"
otherwise.
For example, the pattern .[contains(., "XSLT")]
- matches any item whose typed value contains "XSLT"
as a substring.
+ matches any item whose atomized value contains "XSLT"
as a substring.
It matches values such as the string "XSLT Transformations"
, the
xs:anyURI
value
http://www.w3.org/TR/XSLT
, the attribute node
class="XSD XSLT XPath"
, and the singleton array ["XSLT 4.0"]
.
+ 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 ["XSLT", 1999]
. It will also fail if the item cannot be atomized,
+ for example if it is a map. The rules in