Package net.sf.saxon.pattern

This package provides classes associated with XSLT pattern handling.

See:
          Description

Interface Summary
PatternFinder This interface enables a client to find all nodes in a document that match a particular pattern.
QNameTest Interface for tests against a QName.
SchemaNodeTest Marker interface for schema-element() and schema-attribute() node tests
 

Class Summary
AnchorPattern This is a special pattern that matches the "anchor node"; it is not used for XSLT patterns, but for the selectors that arise when evaluating XPath expressions in streaming mode; the anchor node is the context node for the streamed XPath evaluation.
AnyChildNodeTest An AnyChildNodePattern is the pattern node(), which matches any node except a root node, an attribute node, or a namespace node: in other words, any node that is the child of another node.
AnyNodeTest NodeTest is an interface that enables a test of whether a node has a particular name and type.
CombinedNodeTest A CombinedNodeTest combines two nodetests using one of the operators union (=or), intersect (=and), difference (= "and not").
ConditionalPattern A ConditionalPattern tests a node against one of a number of patterns depending on the value of a condition.
ContentTypeTest NodeTest is an interface that enables a test of whether a node matches particular conditions.
DocumentNodeTest A DocumentNodeTest implements the test document-node(element(~,~))
EmptySequenceTest NodeTest is an interface that enables a test of whether a node has a particular name and type.
ExceptPattern A pattern formed as the difference of two other patterns
IdrefTest IdrefTest is a test that cannot be represented directly in XPath or XSLT patterns, but which is used internally for matching IDREF nodes: it tests whether the node has the is-idref property
IntersectPattern A pattern formed as the difference of two other patterns
ItemTypePattern A ItemTypePattern is a pattern that consists simply of an ItemType.
LocalNameTest NodeTest is an interface that enables a test of whether a node has a particular name and type.
LocationPathPattern A LocationPathPattern represents a path, for example of the form A/B/C...
NamespaceTest NodeTest is an interface that enables a test of whether a node has a particular name and type.
NameTest NodeTest is an interface that enables a test of whether a node has a particular name and type.
NodeKindTest NodeTest is an interface that enables a test of whether a node has a particular name and kind.
NodeSetPattern A NodeSetPattern is a pattern based on an expression that is evaluated to return a set of nodes; a node matches the pattern if it is a member of this node-set.
NodeTest A NodeTest is a simple kind of pattern that enables a context-free test of whether a node matches a given node kind and name.
Pattern A Pattern represents the result of parsing an XSLT pattern string.
PatternMaker This is a singleton class used to convert an expression to an equivalent pattern.
PatternParser Parser for XSLT patterns.
PatternSponsor The PatternSponsor class allows a Pattern to be treated like an expression.
PatternWithPredicate  
UnionPattern A pattern formed as the union (or) of two other patterns
UnionQNameTest A QNameTest that is the union of a number of supplied QNameTests
VennPattern A pattern formed as the union, intersection, or difference of two other patterns
 

Package net.sf.saxon.pattern Description

This package provides classes associated with XSLT pattern handling.

The principal classes are:

Pattern:
This represents an XSLT Pattern. There is a static method Pattern.make() which is used to construct a Pattern from a String (it is a factory method rather than a constructor, because it typically returns some subclass of Pattern according to the syntax supplied). Subclasses of Pattern represent different kinds of pattern such as LocationPathPattern and IDKeyPattern. What they all have in common is a match() method, which determines whether a given node matches the pattern. A pattern is not in itself an Expression, but the class PatternSponsor is used to wrap a pattern making it look like an expression for the benefit of the static analysis (allowing the same mechanisms to be used for example to find all the references to a variable).

NodeTest:
This represents a NodeTest within a step of an XPath expression. A NodeTest performs several roles: as well as its use in conjuction with an axis to form a step of a path expression, it acts as an ItemType used in handling type checking of nodes, and (wrapped in a NodeTestPattern) it acts as an XSLT pattern for use in constructs such as the match attribute of xsl:template and xsl:key. A NodeTest is used directly to implement simple patterns such as match="item" or match="*". There are several subclasses of NodeTest, depending on the conditions to be matched: node type, node name, namespace URI, and so on. The class AnyNodeTest matches any node, while NoNodeTest matches nothing. NodeTests can also be combined using the operators of intersection, difference, and union, to describe the more complex types that are sometimes computed by the type checking machinery.


Michael H. Kay
Saxonica Limited
9 February 2005



Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.