Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.xsl.pattern
Class NodeTestPattern

    java.lang.Object
      com.novell.xsl.pattern.NodeTestPattern

All Implemented Interfaces:
  Pattern

    public class NodeTestPattern

extends Object
implements Pattern

Implements the functionality of a NodeTest in an XSLT Pattern.

Field Summary

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
`NodeTestPattern(NodeTest nodeTest)` Create a NodeTest for nodes other than attributes.
`NodeTestPattern(NodeTest nodeTest, int nodeType)` Create a NodeTest for attributes.

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.
`String` | `toString()` Provide a readable description for debugging.
`protected static NodeTest` | `useNodeTest(NodeTest nodeTest)` Supply a node test object to use based on the passed NodeTest object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NodeTestPattern

    public NodeTestPattern(NodeTest nodeTest)

  Create a NodeTest for nodes other than attributes.

  Parameters:
    `nodeTest` - The XPath NodeTest to use in the Pattern match test.

### NodeTestPattern

    public NodeTestPattern(NodeTest nodeTest,
                           int nodeType)

  Create a NodeTest for attributes. Note: this will work for other than attributes, if a suitable value is passed for nodeType.

  Parameters:
    `nodeTest` - The XPath NodeTest to use in the Pattern match test.
    `nodeType` - Typically, org.w3c.dom.Node.ATTRIBUTE_NODE, but could be any node type value.

Method Detail

### toString

    public String toString()

  Provide a readable description for debugging.

  Overrides:
    `toString` in class `Object`
  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.

### useNodeTest

    protected static NodeTest useNodeTest(NodeTest nodeTest)

  Supply a node test object to use based on the passed NodeTest object. This is used to convert the standard XPath node() node-test to a specialized one for our XSLT Pattern purposes.

  Parameters:
    `nodeTest` - The base (XPath) node test.
  Returns:
    The actual node test object to use

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD