I'm pulling out a CLOB that may or may not have embeded HTML which may or
may not be XHTML...  

I then need to pass it on through a couple of stylesheets to format the
results for a browser.  I'm trying to put the text into a CDATA block so
that the embeded tags will not get processed by later stylesheets.

My thought to date has been that I need the text data to be inserted into
the CDATA block without having the "<" and ">" chars escaped so that any
HTML tags arrive at the end of the pipeline intact.  Additionally, in all
three methods, the "<" and ">" of any XML tags I attempt to insert around
the text ("<![CDATA[]]>" and in the last case "<body_text/>" end up also
escaped and thus treated as text by later stylesheets.

Thanks

Steve

-----Original Message-----
From: Christian Haul [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 2:33 AM
To: [EMAIL PROTECTED]
Subject: Re: Putting the esql:get-ascii inside CDATA block


On 04.Apr.2002 -- 12:06 PM, Steven Sedlmeyer wrote:
> I'm trying to place the results of an <esql:get-ascii column="foo"/> tag
> into a cdata
> block.  I've been able to get close, with the <> ending up in the text
node
> as &lt;
> and &gt; but I can't get them inserted as an actual CDATA block.  Is there
> some simple
> solution I've missed or baring that, a hard one...?

I presume that you want the data inside the CDATA block for the sake
of the client? Since printing out the data would create a text node
for the internal processing and wouldn't be touched by Cocoon at all.

I think it should be possible to print the CDATA instruction
("&lt;![CDATA[") and the ending instruction ("]]&gt;").

> 1.  
> <body_text>
> <![CDATA[<esql:get-ascii column="foo"/>]]>
> </body_text>

Effectively escapes the esql-tag from being replaced by the required
java code.

> 2.
> 
> <xsp:logic>
>       <![CDATA[String cdOpen = "<![CDATA[";  ]]>
>       String cdClose = "]]&gt";
> </xsp:logic>
> 
> <body_text>
> <xsp:expr>cdOpen</xsp:expr><esql:get-ascii
> column="foo"/><xsp:expr>cdClose</xsp:expr>
> </body_text>
> 
> //with various combinations of CDATA blocks and escaped characters in the
> //<xsp:logic/> block 

Mmmh, that _should_ work. Could you please provide us with the java
code produced by this? You'll find it in the work directory of your
servlet engine (e.g. $CATALINA_HOME/work/localhost/cocoon/....)

> 3.  
>       <xsp:logic>
>               <![CDATA[
>               StringBuffer bodyText= new StringBuffer("");
>               bodyText.append("<body_text><![CDATA[");
>               ]]>
>               bodyText.append(<esql:get-ascii column="foo"/>);
>               <![CDATA[
>               bodyText.append("]]");
>               bodyText.append("></body_text>");
>               ]]>
>       </xsp:logic>
>       <xsp:expr disable-output-escaping="yes"
> >bodyText.toString()</xsp:expr>
> 
> // Same results except that the surrounding <body_text> node is now also
> escaped and
> // appears as part of the text node

Wait -- that sounds like a correct result. What are you trying to
achieve exactly?

        Chris.

-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to