com.novell.xsl.pattern
Class RelativePathPattern

java.lang.Object
  extended bycom.novell.xsl.pattern.RelativePathPattern
All Implemented Interfaces:
Pattern
Direct Known Subclasses:
AbsolutePathPattern

public class RelativePathPattern
extends Object
implements Pattern

Implements the following XSLT Pattern constructions: [4] RelativePathPattern


Field Summary
protected  Axis axis
           
protected  RelativePathPattern lhs
           
protected  StepPattern rhs
           
 
Fields inherited from interface com.novell.xsl.pattern.Pattern
ANY_TARGET, ATTRIBUTE_NAMED_TARGET, ATTRIBUTE_WILDCARD_TARGET, COMMENT_TARGET, ELEMENT_NAMED_TARGET, ELEMENT_WILDCARD_TARGET, NAMESPACE_TARGET, PI_TARGET, ROOT_TARGET, TEXT_TARGET
 
Constructor Summary
protected RelativePathPattern()
          Constructor for use by AbsolutePathPattern to represent a pattern of '/'.
protected RelativePathPattern(RelativePathPattern copy)
          Constructor for use by AbsolutePathPattern to represent a pattern of '/' RelativePathPattern
  RelativePathPattern(RelativePathPattern lhs, int opr, StepPattern rhs)
          Construct a RelativePathPattern that corresponds to the XSLT productions: RelativePathPattern := RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern
  RelativePathPattern(StepPattern pattern)
          Construct a RelativePathPattern that corresponds to the XSLT construction: RelativePathPattern ::= StepPattern
 
Method Summary
 void dump(PrintWriter writer, int indent)
          Print the pattern in a readable form for debugging.
 double getDefaultPriority()
          Return the default priority for this pattern.
 int getTarget()
          Return the target type of this Pattern.
 ExpandedQName getTargetName()
          Return the name of the patterns target, if there is a target name.
 boolean match(Node node, ExpressionContext context)
          Return true or false depending on whether the passed node matches the XSLT Pattern or not.
protected  Node performMatch(Node node, ExpressionContext context)
          Perform the match semantics on the passed node.
 String toString()
          Provide a readable description for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lhs

protected RelativePathPattern lhs

axis

protected Axis axis

rhs

protected StepPattern rhs
Constructor Detail

RelativePathPattern

public RelativePathPattern(StepPattern pattern)
Construct a RelativePathPattern that corresponds to the XSLT construction: RelativePathPattern ::= StepPattern

Parameters:
pattern - The StepPattern that makes up the RelativePathPattern

RelativePathPattern

public RelativePathPattern(RelativePathPattern lhs,
                           int opr,
                           StepPattern rhs)
Construct a RelativePathPattern that corresponds to the XSLT productions: RelativePathPattern := RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern

Parameters:
lhs - The RelativePathPattern to which to append the StepPattern.
opr - OperatorToken.SLASH or OperatorToken.SLASH_SLASH.
rhs - The StepPattern to be composed with the RelativePathPattern.

RelativePathPattern

protected RelativePathPattern()
Constructor for use by AbsolutePathPattern to represent a pattern of '/'.


RelativePathPattern

protected RelativePathPattern(RelativePathPattern copy)
Constructor for use by AbsolutePathPattern to represent a pattern of '/' RelativePathPattern

Parameters:
copy - The RelativePathPattern following the '/'
Method Detail

toString

public String toString()
Provide a readable description for debugging.

Returns:
String representation

match

public boolean match(Node node,
                     ExpressionContext context)
              throws XPathEvaluationException
Return true or false depending on whether the passed node matches the XSLT Pattern or not. The passed ExpressionContext is necessary for evaluation of XPath Predicate expressions, which may be part of a Pattern, as well as for namespace resolution.

Specified by:
match in interface Pattern
Parameters:
node - The node to match.
context - The context for matching.
Returns:
True if the node matches the pattern, false otherwise.
Throws:
XPathEvaluationException

getDefaultPriority

public double getDefaultPriority()
Return the default priority for this pattern. See XSLT spec for information on default priority calculation.

Specified by:
getDefaultPriority in interface Pattern
Returns:
-0.5, 0.0, or 0.5

getTarget

public int getTarget()
Return the target type of this Pattern. This is one of the values defined in the Pattern interface (ELEMENT_NAMED_TARGET, ELEMENT_WILDCARD_TARGET, etc.)

Specified by:
getTarget in interface Pattern
Returns:
The target type value for this Pattern.

getTargetName

public ExpandedQName getTargetName()
Return the name of the patterns target, if there is a target name. This may return null if there is no target name for this pattern (text(), node(), etc.). However, if getTarget() returns ELEMENT_NAMED_TARGET or ATTRIBUTE_NAMED_TARGET this will never return null.

Specified by:
getTargetName in interface Pattern
Returns:
The target name or null.

dump

public void dump(PrintWriter writer,
                 int indent)
Print the pattern in a readable form for debugging.

Specified by:
dump in interface Pattern
Parameters:
writer - The output device.
indent - Number of tabs to indent the result.

performMatch

protected Node performMatch(Node node,
                            ExpressionContext context)
                     throws XPathEvaluationException
Perform the match semantics on the passed node. Return the left-most-matching node. This member exists to facilitate AbsolutePathPattern

Parameters:
node - The node to match.
context - The expression context for matching.
Returns:
Node that matches left-most step in path pattern
Throws:
XPathEvaluationException