XTiSP on the Web  Index  Search  Changes  RSS  Login

invite - XTiSP/IV

[English / Japanese]
Top Download Documentation Support Link
Publication XTiSP/PD XTiSP/IV XTiSP/AG
Installation Usage Tutorial Example
Basic Notion Element Non-Element XPath Iteration
invite visit
 

XPath Querying with Map

The 'invite' expression is used as the form of

invite `xpath` do exp done

It returns a sequence of results each of which is returned by exp after the current node is moved to every node satisfying `xpath`, in which you can use before-notation. Initially, the current node is the root node. For example, an XTiSP program

invite `article` do exp done

returns the evaluation result of exp after the current node is moved to the child article of the root. We can refer the name and attributes (as a record) of the element for the current node by . and @, respectively. If you want to refer the name of the current node, just write .; if you want to refer the value of a designate attribute att_name, write as follows:

@('att_name')

We use value() as a non-element expression to refer the text value of the current node, which is defined by a concatenation of all character data that is descendant of the current node. Consider the following XTiSP program:

<HTML> [
 <HEAD> [ <TITLE> [ ] ];
 <BODY> [ 
   invite `article` do { value() } done;
   <BR> [ ];
   invite `article` do {@'author'} done
 ]
]

If the input XML is

<article author="Shakespeare">R and J</article>,

then the XTiSP program above returns

<HTML><HEAD><TITLE/></HEAD><BODY>R and J<BR/>Shakespeare</BODY>
Last modified:2006/06/11 10:08:46
Keyword(s):
References:[TabTree]