You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Barbara Post <ba...@ifrance.com> on 2002/08/29 11:01:20 UTC

bug with javascript ?

c203.

My XSL contains some javascript :

Is it normal that when I look at the source of my html output  I see the
full code (in the body part) written out ?

i.e. :

<script language="javascript">if (document.all){
document.writeln('<object id="factory"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
codebase="ActiveX/ScriptX.cab#Version=\'5,0,4,15\'"></object>');
document.writeln('<p align="center"><input name="idPrint" type="button"
value="Print" onClick="javascript:printSheet();"/></p>');
}</script>

I see the "Print" input but this seems strange. In the xsl I used &lt; and
&gt; tags, but otherwise the bit of code is identical. Thanks, and sorry
whether this is off-topic...

Babs


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

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: bug with javascript ?

Posted by Koen Pellegrims <ko...@pandora.be>.
All I can do to help is show you the way I do it.
I don't use the CDATA-section, because I need xsl-instructions to generate
my JavaScript. Below is a snippet that works for sure (for me at least).
(I did replace 'script' with 'scropt' in an attempt to fool the
virusscan...)

<xsl:template match="/">
	*snip*

	<scropt type="text/javascript">

		/* preload images */
		<xsl:for-each select="products/category">
			<xsl:value-of select="concat('image', position())"/> = new Image();
			<xsl:value-of select="concat('image', position())"/>.src =
			"<xsl:value-of select="concat('images/products/', @id, '/',
logo/@src)"/>";
		</xsl:for-each>
	</scropt>

	*snip*

</xsl:template>

so, no CDATA, not &lt;...
Hope this helps...

Koen

> -----Oorspronkelijk bericht-----
> Van: Barbara Post [mailto:babs33@ifrance.com]
> Verzonden: donderdag 29 augustus 2002 11:33
> Aan: cocoon-users@xml.apache.org
> Onderwerp: Re: bug with javascript ?
>
>
> I tried your suggestion, Koen, (with "<" and ">") but now I see the
> javascript code on my html. It is not executed at all... I use IE 5.5.
>
> Barbara
>
> PS : sorry for double-posting I was warned by the antivirus software.
> ----- Original Message -----
> From: "Koen Pellegrims" <ko...@pandora.be>
> To: <co...@xml.apache.org>
> Sent: Thursday, August 29, 2002 11:22 AM
> Subject: RE: bug with javascript ?
>
>
> > mmm, I don't see where you need to use &lt; and &gt; tags.
> > To make sure your javascript remains untouched, you could put
> the code in
> a
> > CDATA section:
> > <script language="javascript">
> > <![CDATA[
> >   if (document.all) {
> >       ...
> >   }
> > ]]>
> > </script>
> >
> > Koen.
> >
> > > -----Oorspronkelijk bericht-----
> > > Van: Barbara Post [mailto:babs33@ifrance.com]
> > > Verzonden: donderdag 29 augustus 2002 11:01
> > > Aan: cocoon-users@xml.apache.org
> > > Onderwerp: bug with javascript ?
> > >
> > >
> > > c203.
> > >
> > > My XSL contains some javascript :
> > >
> > > Is it normal that when I look at the source of my html output
>  I see the
> > > full code (in the body part) written out ?
> > >
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>


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

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: bug with javascript ?

Posted by Barbara Post <ba...@ifrance.com>.
I tried your suggestion, Koen, (with "<" and ">") but now I see the
javascript code on my html. It is not executed at all... I use IE 5.5.

Barbara

PS : sorry for double-posting I was warned by the antivirus software.
----- Original Message -----
From: "Koen Pellegrims" <ko...@pandora.be>
To: <co...@xml.apache.org>
Sent: Thursday, August 29, 2002 11:22 AM
Subject: RE: bug with javascript ?


> mmm, I don't see where you need to use &lt; and &gt; tags.
> To make sure your javascript remains untouched, you could put the code in
a
> CDATA section:
> <script language="javascript">
> <![CDATA[
>   if (document.all) {
>       ...
>   }
> ]]>
> </script>
>
> Koen.
>
> > -----Oorspronkelijk bericht-----
> > Van: Barbara Post [mailto:babs33@ifrance.com]
> > Verzonden: donderdag 29 augustus 2002 11:01
> > Aan: cocoon-users@xml.apache.org
> > Onderwerp: bug with javascript ?
> >
> >
> > c203.
> >
> > My XSL contains some javascript :
> >
> > Is it normal that when I look at the source of my html output  I see the
> > full code (in the body part) written out ?
> >



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

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: bug with javascript ?

Posted by Koen Pellegrims <ko...@pandora.be>.
mmm, I don't see where you need to use &lt; and &gt; tags.
To make sure your javascript remains untouched, you could put the code in a
CDATA section:
<script language="javascript">
<![CDATA[
  if (document.all) {
      ...
  }
]]>
</script>

Koen.

> -----Oorspronkelijk bericht-----
> Van: Barbara Post [mailto:babs33@ifrance.com]
> Verzonden: donderdag 29 augustus 2002 11:01
> Aan: cocoon-users@xml.apache.org
> Onderwerp: bug with javascript ?
>
>
> c203.
>
> My XSL contains some javascript :
>
> Is it normal that when I look at the source of my html output  I see the
> full code (in the body part) written out ?
>
> i.e. :
>
> <script language="javascript">if (document.all){
> document.writeln('<object id="factory"
> classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
> codebase="ActiveX/ScriptX.cab#Version=\'5,0,4,15\'"></object>');
> document.writeln('<p align="center"><input name="idPrint" type="button"
> value="Print" onClick="javascript:printSheet();"/></p>');
> }</script>
>
> I see the "Print" input but this seems strange. In the xsl I used &lt; and
> &gt; tags, but otherwise the bit of code is identical. Thanks, and sorry
> whether this is off-topic...
>
> Babs
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>


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

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>