tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Twardowski" <>
Subject unsubscribe me:
Date Wed, 20 Jun 2001 19:20:33 GMT

unsubscribe me:

-----Original Message-----
From: James Strachan []
Sent: Wednesday, June 20, 2001 8:01 AM
Subject: Re: xtags taglib - templates and copyOf

Hi Ray

From: "Ray Allis" <>
> I am building a NewsML database application using JSP and XYZFind.
> I'm stuck at handling the HTML (NITF) embedded in
> /NewsML/NewsItem/NewsComponent/ContentItem/DataContent/body/body.content/
> valueOf gives the text without the <p>, <b> etc. markup.  (Of course)
> Supposedly copyOf will copy elements and contents, but I can't get
> beyond errors like "Not allowed to flush in custom tags" or similar.
> template should do copyOf?  Nothing appears in the output.

You're right. <xtags:valueOf> returns the string-value of an XPath
expression (defined in the XPath spec) so it will strip all markup and just
return text.

<xtags:copyOf> is the tag you want, this essentially outputs the XML of the
nodes you select via XPath, with all markup intact.

I've hit the problem of <xtags:copyOf> and "Not allowed to flush in custom
tags" before. There was some code calling flush() in the XTags code (and
sometimes in the dom4j code) which I've patched recently. So maybe if you
use the latest CVS image of the XTags library this problem might go away?

If this doesn't fix your problem it might be something to do with your
Servlet container. Which Servlet container are you using? It might be that
you are hitting a JSP 1.1 issue. Its quite hard to build really useful JSP
custom tags on JSP 1.1 due to the body tag issue - the only way to do loops
in JSP 1.1 is to use body tags and inside body tags in JSP 1.1 you can't
properly do <jsp:include> calls or flush the output. e.g. <xtags:forEach>
has to be a body tag in JSP 1.1 so anything inside your loop is in a body
tag which may cause problems with tags like <xtags:copyOf>).

It might be worth trying out your web app on Tomcat 4.0 which has full
support for JSP 1.2 or WebLogic 6.1 (which I think has JSP 1.2 support also)


> I have read, and I thought
> I understood it.  The best I can do is select .../body.content/p and get
> the (text of) the first paragraph.
> Will someone please help me understand how this works?
> ------ newsitem.jsp ------
> <%@taglib uri="" prefix="io" %>
> <%@ taglib uri=""
> prefix="xtags" %>
> <html>
>    <head>
>      <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1">
>      <title>RSS Styling Demo</title>
>      <link rel="stylesheet" href="examples.css" type="text/css">
>    </head>
>    <body>
>      <h2>Documents</h2>
>      <xtags:parse>
>        <io:http url="" action="POST">
>        <io:header name="Content-Type" value="text/xml"/>
>        <io:pipe>
>          <xyz:input xmlns:xyz="">
>            <xyz:query>
>              <xyz:document name="IndonesiaSummit.xml"/>
>            </xyz:query>
>          </xyz:input>
>        </io:pipe>
>        </io:http>
>      </xtags:parse>
>      <table cellspacing="0" cellpadding="2" bgcolor="#000000" border="1">
>        <tr bgcolor="#dddddd">
>          <th>Headline</th>
>          <th>Dateline</th>
>          <th>Body</th>
>        </tr>
>        <xtags:forEach select="//results/document/NewsItem/NewsComponent">
>          <tr bgcolor="#eeeeee">
>            <td>
>            <xtags:valueOf select="NewsLines/HeadLine"/>
>            </td>
>            <td>
>            <xtags:valueOf select="NewsLines/DateLine"/>
>            </td>
>            <td>
>            <xtags:valueOf
> select="ContentItem/DataContent/body/body.content/p" />
>            </td>
>          </tr>
>        </xtags:forEach>
>      </table>
>    </body>
> </html>
> Ray Allis -

Do You Yahoo!?
Get your free address at

View raw message