tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Townsend" <>
Subject xtags:ForEach question (involving parameters)
Date Thu, 12 Jul 2001 22:52:43 GMT
I am having a problem with forEach in the xtags library. I am trying to
use XPath and xtags to select all of the person entries from my
directory that contain a substring (For example, all of the people who
have 'John' in their name). 

I have an XML file that looks basically like this:

		<name>John Townsend</name>
		...more data...

Here's a piece of my JSP page: 

	<xtags:forEach select = "//person[child::name[contains(text(),
        <TD align=right><xtags:valueOf
          <TD><xtags:valueOf select="name"/></TD>
          <TD><xtags:valueOf select="title"/></TD>
select="email"/>"><xtags:valueOf select="email"/></A></TD>
          <TD><NOBR><xtags:valueOf select="phone"/></NOBR></TD>
          <TD><NOBR><xtags:valueOf select="cell"/></NOBR></TD>
          <TD><NOBR><xtags:valueOf select="home"/></NOBR></TD>
          <TD><xtags:valueOf select="messenger"/></TD></TR>

If my select in the forEach looks like this:

Select = "//person[child::name[contains(text(), 'John')]]"

Then it works. But, I would like to pass in the 'John' parameter from
the URL. The URL would look something like this:


Can I do this? I thought if I put $param in my select statement it would
work, but it didn't seem to work.

Any ideas? Forgive my ignorance of XPath, I am just starting to use the
xtags library and XPath.

-- towns

View raw message