You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Xoan <xo...@gmail.com> on 2005/04/28 17:49:24 UTC

Javascript and xsp

Hi all,

I'm trying to write a xsp with some javascript code. This code uses
functions defined in a .js file.
When I try the html part in a browser all works fine, but when I try
to use the same html code in a xsp seems that the following
instruction is not recognized:

	<script language="JavaScript" type="text/javascript"
src="http://localhost:8080/exist/examples/Editor/library.js"></script>

as when I try to load it the following error appears:

Error function_defined_in_library.js is not defined.

=====
<?xml version="1.0"?>

<xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<script language="JavaScript" type="text/javascript"
src="http://localhost:8080/exist/examples/Editor/library.js"></script>

</head>

<body>

<script language="JavaScript" type="text/javascript">
a_call_to_a function_defined_in_library.js(param1', param2);
</script>

</body>
</html>

</xsp:page>
=====


It is possible to call external javascript code in xsp's?

Any idea on what is happening?

Regards,
Xoan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp --- Possible bug??

Posted by Xoan <xo...@gmail.com>.
My page is a xsp that contains xhtml defined as follows:

<html xmlns="http://www.w3.org/1999/xhtml">

and in the sitemap file :

			<map:match pattern="**.xsp">
				<map:generate src="{1}.xsp" type="serverpages"/>
				<map:serialize  type="html"/>
			</map:match>

What you've said about space between start and end tag is right.



2005/4/29, Jan Hoskens <jh...@schaubroeck.be>:
> Is it somehow remotely possible that you are using an xml serializer to produce the html page(or
> xhtml)? Does the script tag appear as one element in your html page <script .../> ?
> 
> If so, you might want to read this:
> 
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=111088309324290&w=2
> 
> In short: browsers expect an ending tag when you are sending html. So a possible solution is to have
>   some space between the start and end tag or just a ";" for scripttags may do as well:
> 
> <script ...>; </script>
> 
> Remember that most browsers don't support xhtml(read the link!) and are seeing the page as html in
> which case several elements MUST have ending tags.
> 
> Hope this helps.
> 
> Kind Regards,
> Jan
> 
> Xoan wrote:
> > Hi all,
> >
> > Thanks for the info, finally this works!
> >
> > But I was a little disconcerted because, the first time I tried it
> > doesn't works.
> >
> > When I tried the following code (all in the same line):
> >
> > <script language="javascript" type="text/javascript"
> > src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >
> > it doesn't function, but if I move the </script> mark to the next line
> > it works fine!
> >
> > It is that reasonable? What's the explanation for that behaviour?
> >
> > Regards,
> >
> > Xoan
> >
> >
> > 2005/4/28, Xoan <xo...@gmail.com>:
> >
> >>Hi Phil and Nacho,
> >>
> >>I was a little confused with the first Phil's reply, but now I think
> >>that you've answered my doubt.
> >>Tomorrow I'll tell you if it works.
> >>
> >>Thanks a lot,
> >>
> >>Xoan
> >>
> >>2005/4/28, Philippe Guillard <pg...@citycita.net>:
> >>
> >>>Apologize <map:flow language="javascript"> is for flowscript. In your
> >>>case you just add a pipeline anywhere in your sitemap containing
> >>>pipeline for XSP like this :
> >>>
> >>><map:match pattern="*.js">
> >>>        <map:read mime-type="text/javascript" src="{1}.js"/>
> >>></map:match>
> >>>
> >>>and i would put this in the XSP with relative path
> >>><script language="JavaScript" type="text/javascript" src="library.js"/>
> >>>
> >>>Phil
> >>>
> >>>Xoan wrote:
> >>>
> >>>
> >>>>Hi Phil,
> >>>>
> >>>>No, I'm a newbie in Cocoon and I don't have too clear all the process.
> >>>>Where I have to put this entry? Before the map:generate for the xsp??
> >>>>
> >>>>Thanks a lot
> >>>>
> >>>>Xoan
> >>>>
> >>>>
> >>>>2005/4/28, Philippe Guillard <pg...@citycita.net>:
> >>>>
> >>>>
> >>>>
> >>>>>Hi,
> >>>>>
> >>>>>Probably your .js file is not red by Cocoon. Did you attach flowscript
> >>>>>to your sitemap with a  <map:flow language="javascript"> entry?
> >>>>>
> >>>>>Phil
> >>>>>
> >>>>>Xoan wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi all,
> >>>>>>
> >>>>>>I'm trying to write a xsp with some javascript code. This code uses
> >>>>>>functions defined in a .js file.
> >>>>>>When I try the html part in a browser all works fine, but when I try
> >>>>>>to use the same html code in a xsp seems that the following
> >>>>>>instruction is not recognized:
> >>>>>>
> >>>>>>     <script language="JavaScript" type="text/javascript"
> >>>>>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >>>>>>
> >>>>>>as when I try to load it the following error appears:
> >>>>>>
> >>>>>>Error function_defined_in_library.js is not defined.
> >>>>>>
> >>>>>>=====
> >>>>>><?xml version="1.0"?>
> >>>>>>
> >>>>>><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
> >>>>>>
> >>>>>><html xmlns="http://www.w3.org/1999/xhtml">
> >>>>>>
> >>>>>><head>
> >>>>>>     <script language="JavaScript" type="text/javascript"
> >>>>>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >>>>>>
> >>>>>></head>
> >>>>>>
> >>>>>><body>
> >>>>>>
> >>>>>><script language="JavaScript" type="text/javascript">
> >>>>>>a_call_to_a function_defined_in_library.js(param1', param2);
> >>>>>></script>
> >>>>>>
> >>>>>></body>
> >>>>>></html>
> >>>>>>
> >>>>>></xsp:page>
> >>>>>>=====
> >>>>>>
> >>>>>>
> >>>>>>It is possible to call external javascript code in xsp's?
> >>>>>>
> >>>>>>Any idea on what is happening?
> >>>>>>
> >>>>>>Regards,
> >>>>>>Xoan
> >>>>>>
> >>>>>>---------------------------------------------------------------------
> >>>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>>>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp --- Possible bug??

Posted by Jan Hoskens <jh...@schaubroeck.be>.
Is it somehow remotely possible that you are using an xml serializer to produce the html page(or 
xhtml)? Does the script tag appear as one element in your html page <script .../> ?

If so, you might want to read this:

http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=111088309324290&w=2

In short: browsers expect an ending tag when you are sending html. So a possible solution is to have 
  some space between the start and end tag or just a ";" for scripttags may do as well:

<script ...>; </script>

Remember that most browsers don't support xhtml(read the link!) and are seeing the page as html in 
which case several elements MUST have ending tags.

Hope this helps.

Kind Regards,
Jan

Xoan wrote:
> Hi all,
> 
> Thanks for the info, finally this works!
> 
> But I was a little disconcerted because, the first time I tried it
> doesn't works.
> 
> When I tried the following code (all in the same line):
> 
> <script language="javascript" type="text/javascript"
> src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> 
> it doesn't function, but if I move the </script> mark to the next line
> it works fine!
> 
> It is that reasonable? What's the explanation for that behaviour?
> 
> Regards,
> 
> Xoan
> 
> 
> 2005/4/28, Xoan <xo...@gmail.com>:
> 
>>Hi Phil and Nacho,
>>
>>I was a little confused with the first Phil's reply, but now I think
>>that you've answered my doubt.
>>Tomorrow I'll tell you if it works.
>>
>>Thanks a lot,
>>
>>Xoan
>>
>>2005/4/28, Philippe Guillard <pg...@citycita.net>:
>>
>>>Apologize <map:flow language="javascript"> is for flowscript. In your
>>>case you just add a pipeline anywhere in your sitemap containing
>>>pipeline for XSP like this :
>>>
>>><map:match pattern="*.js">
>>>        <map:read mime-type="text/javascript" src="{1}.js"/>
>>></map:match>
>>>
>>>and i would put this in the XSP with relative path
>>><script language="JavaScript" type="text/javascript" src="library.js"/>
>>>
>>>Phil
>>>
>>>Xoan wrote:
>>>
>>>
>>>>Hi Phil,
>>>>
>>>>No, I'm a newbie in Cocoon and I don't have too clear all the process.
>>>>Where I have to put this entry? Before the map:generate for the xsp??
>>>>
>>>>Thanks a lot
>>>>
>>>>Xoan
>>>>
>>>>
>>>>2005/4/28, Philippe Guillard <pg...@citycita.net>:
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>Probably your .js file is not red by Cocoon. Did you attach flowscript
>>>>>to your sitemap with a  <map:flow language="javascript"> entry?
>>>>>
>>>>>Phil
>>>>>
>>>>>Xoan wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hi all,
>>>>>>
>>>>>>I'm trying to write a xsp with some javascript code. This code uses
>>>>>>functions defined in a .js file.
>>>>>>When I try the html part in a browser all works fine, but when I try
>>>>>>to use the same html code in a xsp seems that the following
>>>>>>instruction is not recognized:
>>>>>>
>>>>>>     <script language="JavaScript" type="text/javascript"
>>>>>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
>>>>>>
>>>>>>as when I try to load it the following error appears:
>>>>>>
>>>>>>Error function_defined_in_library.js is not defined.
>>>>>>
>>>>>>=====
>>>>>><?xml version="1.0"?>
>>>>>>
>>>>>><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
>>>>>>
>>>>>><html xmlns="http://www.w3.org/1999/xhtml">
>>>>>>
>>>>>><head>
>>>>>>     <script language="JavaScript" type="text/javascript"
>>>>>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
>>>>>>
>>>>>></head>
>>>>>>
>>>>>><body>
>>>>>>
>>>>>><script language="JavaScript" type="text/javascript">
>>>>>>a_call_to_a function_defined_in_library.js(param1', param2);
>>>>>></script>
>>>>>>
>>>>>></body>
>>>>>></html>
>>>>>>
>>>>>></xsp:page>
>>>>>>=====
>>>>>>
>>>>>>
>>>>>>It is possible to call external javascript code in xsp's?
>>>>>>
>>>>>>Any idea on what is happening?
>>>>>>
>>>>>>Regards,
>>>>>>Xoan
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp --- Possible bug??

Posted by Xoan <xo...@gmail.com>.
Hi all,

Thanks for the info, finally this works!

But I was a little disconcerted because, the first time I tried it
doesn't works.

When I tried the following code (all in the same line):

<script language="javascript" type="text/javascript"
src="http://localhost:8080/exist/examples/Editor/library.js"></script>

it doesn't function, but if I move the </script> mark to the next line
it works fine!

It is that reasonable? What's the explanation for that behaviour?

Regards,

Xoan


2005/4/28, Xoan <xo...@gmail.com>:
> Hi Phil and Nacho,
> 
> I was a little confused with the first Phil's reply, but now I think
> that you've answered my doubt.
> Tomorrow I'll tell you if it works.
> 
> Thanks a lot,
> 
> Xoan
> 
> 2005/4/28, Philippe Guillard <pg...@citycita.net>:
> > Apologize <map:flow language="javascript"> is for flowscript. In your
> > case you just add a pipeline anywhere in your sitemap containing
> > pipeline for XSP like this :
> >
> > <map:match pattern="*.js">
> >         <map:read mime-type="text/javascript" src="{1}.js"/>
> > </map:match>
> >
> > and i would put this in the XSP with relative path
> > <script language="JavaScript" type="text/javascript" src="library.js"/>
> >
> > Phil
> >
> > Xoan wrote:
> >
> > >Hi Phil,
> > >
> > >No, I'm a newbie in Cocoon and I don't have too clear all the process.
> > >Where I have to put this entry? Before the map:generate for the xsp??
> > >
> > >Thanks a lot
> > >
> > >Xoan
> > >
> > >
> > >2005/4/28, Philippe Guillard <pg...@citycita.net>:
> > >
> > >
> > >>Hi,
> > >>
> > >>Probably your .js file is not red by Cocoon. Did you attach flowscript
> > >>to your sitemap with a  <map:flow language="javascript"> entry?
> > >>
> > >>Phil
> > >>
> > >>Xoan wrote:
> > >>
> > >>
> > >>
> > >>>Hi all,
> > >>>
> > >>>I'm trying to write a xsp with some javascript code. This code uses
> > >>>functions defined in a .js file.
> > >>>When I try the html part in a browser all works fine, but when I try
> > >>>to use the same html code in a xsp seems that the following
> > >>>instruction is not recognized:
> > >>>
> > >>>      <script language="JavaScript" type="text/javascript"
> > >>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> > >>>
> > >>>as when I try to load it the following error appears:
> > >>>
> > >>>Error function_defined_in_library.js is not defined.
> > >>>
> > >>>=====
> > >>><?xml version="1.0"?>
> > >>>
> > >>><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
> > >>>
> > >>><html xmlns="http://www.w3.org/1999/xhtml">
> > >>>
> > >>><head>
> > >>>      <script language="JavaScript" type="text/javascript"
> > >>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> > >>>
> > >>></head>
> > >>>
> > >>><body>
> > >>>
> > >>><script language="JavaScript" type="text/javascript">
> > >>>a_call_to_a function_defined_in_library.js(param1', param2);
> > >>></script>
> > >>>
> > >>></body>
> > >>></html>
> > >>>
> > >>></xsp:page>
> > >>>=====
> > >>>
> > >>>
> > >>>It is possible to call external javascript code in xsp's?
> > >>>
> > >>>Any idea on what is happening?
> > >>>
> > >>>Regards,
> > >>>Xoan
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > >>>For additional commands, e-mail: users-help@cocoon.apache.org
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > >>For additional commands, e-mail: users-help@cocoon.apache.org
> > >>
> > >>
> > >>
> > >>
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > >For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp

Posted by Xoan <xo...@gmail.com>.
Hi Phil and Nacho,

I was a little confused with the first Phil's reply, but now I think
that you've answered my doubt.
Tomorrow I'll tell you if it works.

Thanks a lot,

Xoan

2005/4/28, Philippe Guillard <pg...@citycita.net>:
> Apologize <map:flow language="javascript"> is for flowscript. In your
> case you just add a pipeline anywhere in your sitemap containing
> pipeline for XSP like this :
> 
> <map:match pattern="*.js">
>         <map:read mime-type="text/javascript" src="{1}.js"/>
> </map:match>
> 
> and i would put this in the XSP with relative path
> <script language="JavaScript" type="text/javascript" src="library.js"/>
> 
> Phil
> 
> Xoan wrote:
> 
> >Hi Phil,
> >
> >No, I'm a newbie in Cocoon and I don't have too clear all the process.
> >Where I have to put this entry? Before the map:generate for the xsp??
> >
> >Thanks a lot
> >
> >Xoan
> >
> >
> >2005/4/28, Philippe Guillard <pg...@citycita.net>:
> >
> >
> >>Hi,
> >>
> >>Probably your .js file is not red by Cocoon. Did you attach flowscript
> >>to your sitemap with a  <map:flow language="javascript"> entry?
> >>
> >>Phil
> >>
> >>Xoan wrote:
> >>
> >>
> >>
> >>>Hi all,
> >>>
> >>>I'm trying to write a xsp with some javascript code. This code uses
> >>>functions defined in a .js file.
> >>>When I try the html part in a browser all works fine, but when I try
> >>>to use the same html code in a xsp seems that the following
> >>>instruction is not recognized:
> >>>
> >>>      <script language="JavaScript" type="text/javascript"
> >>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >>>
> >>>as when I try to load it the following error appears:
> >>>
> >>>Error function_defined_in_library.js is not defined.
> >>>
> >>>=====
> >>><?xml version="1.0"?>
> >>>
> >>><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
> >>>
> >>><html xmlns="http://www.w3.org/1999/xhtml">
> >>>
> >>><head>
> >>>      <script language="JavaScript" type="text/javascript"
> >>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >>>
> >>></head>
> >>>
> >>><body>
> >>>
> >>><script language="JavaScript" type="text/javascript">
> >>>a_call_to_a function_defined_in_library.js(param1', param2);
> >>></script>
> >>>
> >>></body>
> >>></html>
> >>>
> >>></xsp:page>
> >>>=====
> >>>
> >>>
> >>>It is possible to call external javascript code in xsp's?
> >>>
> >>>Any idea on what is happening?
> >>>
> >>>Regards,
> >>>Xoan
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp

Posted by Philippe Guillard <pg...@citycita.net>.
Apologize <map:flow language="javascript"> is for flowscript. In your 
case you just add a pipeline anywhere in your sitemap containing 
pipeline for XSP like this :

<map:match pattern="*.js">
        <map:read mime-type="text/javascript" src="{1}.js"/>
</map:match>

and i would put this in the XSP with relative path
<script language="JavaScript" type="text/javascript" src="library.js"/>

Phil

Xoan wrote:

>Hi Phil,
>
>No, I'm a newbie in Cocoon and I don't have too clear all the process.
>Where I have to put this entry? Before the map:generate for the xsp??
>
>Thanks a lot
>
>Xoan
>
>
>2005/4/28, Philippe Guillard <pg...@citycita.net>:
>  
>
>>Hi,
>>
>>Probably your .js file is not red by Cocoon. Did you attach flowscript
>>to your sitemap with a  <map:flow language="javascript"> entry?
>>
>>Phil
>>
>>Xoan wrote:
>>
>>    
>>
>>>Hi all,
>>>
>>>I'm trying to write a xsp with some javascript code. This code uses
>>>functions defined in a .js file.
>>>When I try the html part in a browser all works fine, but when I try
>>>to use the same html code in a xsp seems that the following
>>>instruction is not recognized:
>>>
>>>      <script language="JavaScript" type="text/javascript"
>>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
>>>
>>>as when I try to load it the following error appears:
>>>
>>>Error function_defined_in_library.js is not defined.
>>>
>>>=====
>>><?xml version="1.0"?>
>>>
>>><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
>>>
>>><html xmlns="http://www.w3.org/1999/xhtml">
>>>
>>><head>
>>>      <script language="JavaScript" type="text/javascript"
>>>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
>>>
>>></head>
>>>
>>><body>
>>>
>>><script language="JavaScript" type="text/javascript">
>>>a_call_to_a function_defined_in_library.js(param1', param2);
>>></script>
>>>
>>></body>
>>></html>
>>>
>>></xsp:page>
>>>=====
>>>
>>>
>>>It is possible to call external javascript code in xsp's?
>>>
>>>Any idea on what is happening?
>>>
>>>Regards,
>>>Xoan
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp

Posted by Nacho Jimenez <na...@gmail.com>.
Hi Phil & Xoan

Firstly, you've to be clear on who's going to run the javascript code.
One thing is using javascript code inside cocoon (via flowscript, for
example) and a very different thing is using cocoon to serve
javascript code so that the client browser runs it.

>From your example, I'd say you're trying to do the second thing. For
that matter, you don't have to do anything special, just check that
the resulting html page received on the browser is as you expected,
and that a pipeline that matches the javascript URI
(examples/Editor/library.js) replies with the appropiate resource..

To make things cleaner, i'd put all my client-bound javascript
together in a "scripts" subdirectory and create the following
pipeline.

      <map:match pattern="scripts/*.js">
        <map:read mime-type="text/javascript" src="scripts/{1}.js"/>
      </map:match>

After that, just call your JS libraries with a 

    <script language="JavaScript" type="text/javascript"
src="scripts/library.js"/>

I hope i've made myself clear enough..

Nacho
 

2005/4/28, Xoan <xo...@gmail.com>:
> Hi Phil,
> 
> No, I'm a newbie in Cocoon and I don't have too clear all the process.
> Where I have to put this entry? Before the map:generate for the xsp??
> 
> Thanks a lot
> 
> Xoan
> 
> 2005/4/28, Philippe Guillard <pg...@citycita.net>:
> > Hi,
> >
> > Probably your .js file is not red by Cocoon. Did you attach flowscript
> > to your sitemap with a  <map:flow language="javascript"> entry?
> >
> > Phil
> >
> > Xoan wrote:
> >
> > >Hi all,
> > >
> > >I'm trying to write a xsp with some javascript code. This code uses
> > >functions defined in a .js file.
> > >When I try the html part in a browser all works fine, but when I try
> > >to use the same html code in a xsp seems that the following
> > >instruction is not recognized:
> > >
> > >       <script language="JavaScript" type="text/javascript"
> > >src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> > >
> > >as when I try to load it the following error appears:
> > >
> > >Error function_defined_in_library.js is not defined.
> > >
> > >=====
> > ><?xml version="1.0"?>
> > >
> > ><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
> > >
> > ><html xmlns="http://www.w3.org/1999/xhtml">
> > >
> > ><head>
> > >       <script language="JavaScript" type="text/javascript"
> > >src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> > >
> > ></head>
> > >
> > ><body>
> > >
> > ><script language="JavaScript" type="text/javascript">
> > >a_call_to_a function_defined_in_library.js(param1', param2);
> > ></script>
> > >
> > ></body>
> > ></html>
> > >
> > ></xsp:page>
> > >=====
> > >
> > >
> > >It is possible to call external javascript code in xsp's?
> > >
> > >Any idea on what is happening?
> > >
> > >Regards,
> > >Xoan
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > >For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp

Posted by Xoan <xo...@gmail.com>.
Hi Phil,

No, I'm a newbie in Cocoon and I don't have too clear all the process.
Where I have to put this entry? Before the map:generate for the xsp??

Thanks a lot

Xoan


2005/4/28, Philippe Guillard <pg...@citycita.net>:
> Hi,
> 
> Probably your .js file is not red by Cocoon. Did you attach flowscript
> to your sitemap with a  <map:flow language="javascript"> entry?
> 
> Phil
> 
> Xoan wrote:
> 
> >Hi all,
> >
> >I'm trying to write a xsp with some javascript code. This code uses
> >functions defined in a .js file.
> >When I try the html part in a browser all works fine, but when I try
> >to use the same html code in a xsp seems that the following
> >instruction is not recognized:
> >
> >       <script language="JavaScript" type="text/javascript"
> >src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >
> >as when I try to load it the following error appears:
> >
> >Error function_defined_in_library.js is not defined.
> >
> >=====
> ><?xml version="1.0"?>
> >
> ><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
> >
> ><html xmlns="http://www.w3.org/1999/xhtml">
> >
> ><head>
> >       <script language="JavaScript" type="text/javascript"
> >src="http://localhost:8080/exist/examples/Editor/library.js"></script>
> >
> ></head>
> >
> ><body>
> >
> ><script language="JavaScript" type="text/javascript">
> >a_call_to_a function_defined_in_library.js(param1', param2);
> ></script>
> >
> ></body>
> ></html>
> >
> ></xsp:page>
> >=====
> >
> >
> >It is possible to call external javascript code in xsp's?
> >
> >Any idea on what is happening?
> >
> >Regards,
> >Xoan
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript and xsp

Posted by Philippe Guillard <pg...@citycita.net>.
Hi,

Probably your .js file is not red by Cocoon. Did you attach flowscript 
to your sitemap with a  <map:flow language="javascript"> entry?

Phil

Xoan wrote:

>Hi all,
>
>I'm trying to write a xsp with some javascript code. This code uses
>functions defined in a .js file.
>When I try the html part in a browser all works fine, but when I try
>to use the same html code in a xsp seems that the following
>instruction is not recognized:
>
>	<script language="JavaScript" type="text/javascript"
>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
>
>as when I try to load it the following error appears:
>
>Error function_defined_in_library.js is not defined.
>
>=====
><?xml version="1.0"?>
>
><xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
>
><html xmlns="http://www.w3.org/1999/xhtml">
>
><head>
>	<script language="JavaScript" type="text/javascript"
>src="http://localhost:8080/exist/examples/Editor/library.js"></script>
>
></head>
>
><body>
>
><script language="JavaScript" type="text/javascript">
>a_call_to_a function_defined_in_library.js(param1', param2);
></script>
>
></body>
></html>
>
></xsp:page>
>=====
>
>
>It is possible to call external javascript code in xsp's?
>
>Any idea on what is happening?
>
>Regards,
>Xoan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org