You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Steve Conover <sc...@groundswell.net> on 2000/09/13 01:49:51 UTC

kinda OT: problems generating javascript from xsl

Hi everyone, 

Maybe someone here can give this a shot.  I have some javascript I want to
run on the client side, so in my final xsl stylesheet I have something like
this:

<script Language="JavaScript">
					//<xsl:comment><![CDATA[ 
							function
MoveItem(fromObj,toObj)
								{
						   			//
remove the primer option if it is still there.
						
						   			if
(toObj.options[0])
	
{
	
if (toObj.options[0].value=="primer") toObj.options[0] = null
	
}
	
//blah blah
								}
						
				// ]]></xsl:comment>
	</script>

I get some wacky error about conditional commands not being set or something

I noticed that when i do a "view source" in the browser, all my javascript
gets flattened into one line.  I would assume that the browser doesn't know
that that there are supposed to be seperate lines of code in there, and
maybe the browser's javascript interpreter is trying to parse html beyond
what's in the script tags because of that.  How can I get xsl to preserve
the carraige returns in my javascript?

Regards,
Steve

Re: kinda OT: problems generating javascript from xsl

Posted by Greg Martin <gr...@netidea.com>.
Steve Conover wrote:
> 
> Hi everyone,
> 
> Maybe someone here can give this a shot.  I have some javascript I want to
> run on the client side, so in my final xsl stylesheet I have something like
> this:
> 

> what's in the script tags because of that.  How can I get xsl to preserve
> the carraige returns in my javascript?
> 
It might work for you to put semi-colons at the end of your lines.

-- 
Regards,
Greg Martin
gregm@netidea.com