[Yanel-dev] CDATA and comments problem

Michael Wechner michael.wechner at wyona.com
Tue Mar 4 22:31:26 CET 2008


Evaldas Taroza wrote:

> Hi,
> I have a problem when trying to pipe an XML through jelly and XSLTs.
> consider a jelly which has a script tag:
> <script>
>  if(1<2){
>   alert("OK");
>  }
> </script>
>
> This jelly won't work. So we change it into:
> <script>
> <![CDATA[
>  if(1<2){
>   alert("OK");
>  }
> ]]>
> </script>
>
> After this passes the jelly engine I get:
> <script>
>  if(1 &lt; 2){
>   alert("OK");
>  }
> </script>
>
> This is illegal javascript. So it won't work. We change the initial 
> script a bit:
> <script>
> &lt;!--
>  if(1 < 2){
>   alert("OK");
>  }
> //--&gt;
> </script>
>
> This passes the jelly fine and we get:
> <script>
> <!--
>  if(1 < 2){
>   alert("OK");
>  }
> //-->
> </script>
>
> This script would work in html world. Now the problem that this output 
> should also get through I18nTransformer2 and XIncludeTransformer of 
> Yanel. So afterwards I get:
> <script>
>
> </script


I guess it's a bug that either the I18nTransformer2 or the 
XIncludeTransformer are stripping comments.

Have you debugged which transformer is actually stripping the comment?

As a workaround you might want to reference the Javascript <link .../> 
or does it need to generated dynamically?

HTH

Michi

>
> So how to pipe jelly->i18n->xinclude so that finally we could get a 
> working (x)html.
>
> Evaldas
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner at wyona.com, michi at apache.org
+41 44 272 91 61



More information about the Yanel-development mailing list