Friday, May 22, 2009

XPath 1.0 node tests

Previously, I discussed axes. Here I turn to node tests. Here is the syntax:

  • every XML name is a node test
  • * is a node test
  • node() and text() are node tests

There is a satisfaction relation between node tests and nodes in a document:

  • for all XML names φ, D,n := φ iff. n is an element or attribute node labelled φ
  • D,n := * iff. n is an element or attribute node
  • for all n, D,n := node()
  • D,n := text() iff. n is a text node

The simplest kind of 'location step' has the form α::τ where α is an axis and τ is a node test. In this case: [[α::τ]]D,n = [[α]]D,n ∩ {n | n∈D, D,n:=τ}.

No comments:

Post a Comment