xpatheval
Evaluate an XPath expression to boolean on an XML document
Index > Books > Declarative Development Guide > Reference Library > Accessor Listing > xpatheval

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Module

urn:org:ten60:netkernel:ext:xml:ura

Definition

Active URI Base

active:xpatheval

Format

<instr>
  <type>xpatheval</type>
  <operand>foo.xml</operand>
  <operator>bar.xml</operator>
  <target>this:response</target>
</instr>

Syntax

ArgumentRulesDescription
typeMandatory xpatheval
operandMandatory the resource to be tested
operatorMandatory a canonical XPath
targetMandatory Fragment OKthe target resource

The xpatheval accessor is used to perform a boolean test of an xpath expression on the operand. The operator contains a canonical XPath expression to be evaluated on the operand. xpatheval is often used for controlling process flow.

The truth of an XPath expression can include the document tree matches an xpath location, the value of a location matches a given value or an XPath function matches some value, or a combination of all of these. More information is avaliable here

xpatheval returns a canonical boolean document: <b>t</b> true, or <b>f</b> false

Example

Test if an Attribute has a given value

<idoc>  <instr>
    <type>xpatheval</type>
    <operand>
      <a>
        <b name="foo" />
      </a>
    </operand>
    <operator>
      <xpath>//b[@name='foo']</xpath>
    </operator>
    <target>this:response</target>
  </instr>
</idoc>

An example of using xpatheval to test if the operand document has an element <b> with an attribute name with value 'foo'. In this example the xpatheval returns true in the form of a canonical boolean document <b>t</b>


(C) 2003, 1060 Research Limited
© 2003-2005, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.