Skip to main content
blob: d761d1947313ad5b7409f3f62ba9029c48c4a6f3 (plain) (tree)


<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css"/>
<title>Essential XPath</title>
<h2>Essential XPath</h2>
JET implements the <a href="">W3C XPath 1.0 Specification</a>, with a few minor exceptions.
Although the XPath language is rich, there are only a small part of the XPath language that is required to use most
JET tags.
<p>XPath (and JET) assumes that it is working on a model that has a tree structure. While this
certainly include XML documents (the X in XPath), it can include many other kinds of models as well. Out of the box,
JET supports XML documents and any model that is represented by EMF. 
(See <a href="">Eclipse Modeling Framework</a>).
<p>A major element of XPath is the <b>path expression</b>. These are similar to file system paths. 
  <li> An path is a series of <b>steps</b> separated by forward slashes (/).</li>
  <li> The steps are evaluated from left to right, and generally decend the model's tree as they do so. </li>
  <li> Each step generally identifies tree nodes by their name (although other possibilities exist).</li>
  <li> Steps may have an optional filter condition which is written in square brackets ([ and ]) at the end of the step.</li>
  <li> An initial slash (/) indicates an expression starts at the root of the model tree.</li>
  <li> Path expressions can also start with a variable, which is a name preceded by a dollar sign ($). 
<p>XPath also supports general mathematical, boolean and comparison expressions as well as function calls.</p>
<p>JET tags that use XPath expressions have common characteristics:
  <li>Variables are defined by several JET tags - look for a <code>var</code> attribute. They may also be defined by
  the <code><a href="../references/taglibs/controlTags/setVariableTag.html">c:setVariable</a></code> tag.</li>
  <li> JET tags requiring a path expresion have a <code>select</code> attribute.</li>
  <li> JET tags requiring a boolean expression have a <code>test</code>.</li>
  <li> Any tag attribute may include a dynamic XPath expression - an XPath expression surrounded by braces ({ and }).</li>
<p>The following tutorials provide a quick introduction to XPath expressions. The first tutorial allows you to
type expressions, and see their results!
  <li> <a href=""></a> </li>
  <li> <a href=""></a> </li>


Back to the top