tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: xtags taglib - templates and copyOf
Date Wed, 20 Jun 2001 12:00:34 GMT
Hi Ray

From: "Ray Allis" <ray.allis@boeing.com>
> 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)

James

>
> I have read http://www.dpawson.co.uk/xsl/sect2/N4554.html, 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="http://jakarta.apache.org/taglibs/io-1.0" prefix="io" %>
> <%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0"
> 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="http://analogy.sea.boeing.com:1234" action="POST">
>        <io:header name="Content-Type" value="text/xml"/>
>        <io:pipe>
>          <xyz:input xmlns:xyz="http://xyzfind.com/schemas/xyzql/1.0">
>            <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 - ray.allis@boeing.com
>
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Mime
View raw message