Skip to main content
summaryrefslogtreecommitdiffstats
blob: 09f90f4d595e6ec59b1e847efe063b7585a1bd2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
<TITLE>&lt;c:visitor&gt; - Standard JET2 Control Tags</TITLE>
</HEAD>
<BODY>
<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
	<TBODY>
		<TR>
			<TH align="left">
			<P>&lt;c:visitor&gt;</P></TH>
			<TH align="right"><A href="overview.html">Standard JET2 Control Tags</A></TH>
		</TR>
	</TBODY>
</TABLE>
<HR>
<P><B>visitor</B></P>
<P><P>               *** PROTOTYPE *** Iterate over an object and all its contained objects, typically be doing a depth-first traversal. For each identified object, the tag evaluates the 'test' condition on its contained 'visit' tags. Only those tags whose test condition is true have their contents processed.<P><P>If the 'select' XPath expression returns more than one object, only the first is written. If the XPath expression selects no objects, then an error occurs, unless the 'default' attribute is specified. If the 'select' XPath expression is malformed, then an error occurs.<P>            </P>
<HR>
<TABLE border="1" width="100%">
	<TBODY>
		<TR>
			<TH colspan="2" align="left">Tag Summary</TH></TR>
		<TR>
			<TD width="10%">required</TD>
			<TD><SPAN style="font-family: monospace">
			&lt;c:visitor select=&quot;<I>value</I>&quot; var=&quot;<I>value</I>&quot;&gt;<br>
			&nbsp;&nbsp;&nbsp;&nbsp;<I>content to be repeated for each iteration</I><BR>
			&lt;/c:visitor&gt;
			</SPAN></TD>
		</TR>
		<TR>
			<TD width="10%">full tag</TD>
			<TD><SPAN style="font-family: monospace">
			&lt;c:visitor select=&quot;<I>value</I>&quot; var=&quot;<I>value</I>&quot;&gt;<br>
			&nbsp;&nbsp;&nbsp;&nbsp;<I>content to be repeated for each iteration</I><BR>
			&lt;/c:visitor&gt;
			</SPAN></TD>
		</TR>
	</TBODY>
</TABLE>
<HR>
<TABLE border="1" width="100%">
	<TBODY>
		<TR>
			<TH colspan="2" align="left">Required Attributes</TH></TR>
		<TR>
			<TD width="10%">select</TD>
			<TD><BR>                  The XPath expression to evaluate.<BR>               </TD>
		</TR>
		<TR>
			<TD width="10%">var</TD>
			<TD><BR>                  The name of a variable that will contain the current object in the iteration.<BR>               </TD>
		</TR>
	</TBODY>
</TABLE>
<HR>
<TABLE border="1" width="100%">
	<TBODY>
		<TR>
			<TH colspan="2" align="left">Example</TH></TR>
		<TR>
			<TD width="10%"></TD>
			<TD><SPAN style="font-family: monospace">
<!-- Begin visitor example -->
			&lt;%-- traverse a model starting at $root. $cur refers to current node --%>
			&lt;c:visitor select=&quot;$root&quot; var=&quot;cur&quot;&gt;<br>
			&lt;c:visit test=&quot;local-name($cur) = 'a'&quot;&gt;<BR>
			&nbsp;&nbsp;&nbsp;&nbsp;<I>content to process of test is true</I><BR>
			&lt;/c:visit&gt;<BR>
			&nbsp;&nbsp;&nbsp;&nbsp;<I>... other &lt;c:visit&gt; tags ...</I><BR>
			&lt;/c:visitor&gt;
<!-- End visitor example -->
</SPAN></TD>
		</TR>
	</TBODY>
</TABLE>
<P></P></BODY>
</HTML>

Back to the top