You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beyaNet Consultancy <be...@ntlworld.com> on 2004/02/15 18:30:46 UTC
Processing issue.....
Hi,
I am having problems with an image string which prints the string to
the screen instead of loading the image!
1. in my xsp page I first build up the image string as so:
<xsp:logic>
String num = "39";
StringBuffer sb = new StringBuffer()
.append("<img src=\"")
.append(num)
.append(".jpg\" border=\"0\" width=\"200\" height=\"200\" />");
String artist1 = sb.toString();
</xsp:logic>
<page>
<artists-photo1>
<xsp:expr>artist1</xsp:expr>
</artists-photo1>
</page>
2. In my XSL page I do the following(snippet....):
..........
<tr>
<td><xsl:apply-templates select="//artists-photo1"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="artists-photo1">
<xsl:apply-templates />
</xsl:template>
What am I doing wrong?
The XML output generated to the screen is (snippet..), which looks ok
to me but doesn't process the image tag line!!!:
-
<body>
-
<table leftmargin="0" marginheight="0" cellspacing="0" cellpadding="0"
border="0">
</tr>
-
<tr>
-
<td>
<img src="39.jpg" border="0" width="200" height="200" />
</td>
</tr>
</table>
</body>
</html>
many thanks in advance...
Re: Processing issue.....
Posted by Geoff Howard <co...@leverageweb.com>.
beyaNet Consultancy wrote:
> Hi,
> I am having problems with an image string which prints the string to the
> screen instead of loading the image!
>
> 1. in my xsp page I first build up the image string as so:
>
> <xsp:logic>
> String num = "39";
> StringBuffer sb = new StringBuffer()
> .append("<img src=\"")
> .append(num)
> .append(".jpg\" border=\"0\" width=\"200\" height=\"200\" />");
>
>
> String artist1 = sb.toString();
> </xsp:logic>
Simple - a Cocoon pipeline is a pipeline of sax events. Sax is an event
based representation of pre-parsed xml, and so handles element events
and character events separately. The code you showed results in
inserting character events into the sax stream which will never be
interpreted as element events. Look into xsp:element and xsp:attribute
to accomplish what you are trying to do.
Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org