You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by lfhc <lu...@gmail.com> on 2007/06/17 20:33:42 UTC
Including a js file
Hi all,
I'm using cocoon to translate an xml file to html, to generate the interface
from a content I get from a cms.
On that interface I want to include some javascripts such as :
<head>
<script src="prototype.js" type="text/javascript"></script>
<script src="effects.js" type="text/javascript"></script>
...
And I would like this to be allocated within cocoon, since it should handle
all that is interface.
My problem is that, if I don't register it in the sitemap.xmap file, any
call will give me a sitemap.xmap file - Resource not foud.
If I set an instance, it will try to parse it, and it is not an xml file. I
get the following error :
org.xml.sax.SAXParseException: Content is not allowed in prolog.
file:/C:/installers/cocoon/cocoon-2.1.10/build/webapp/samples/aggregation/content/prototype.js
- 1:1
How can I do this, that is, have just a resource for this webapp, that is
not parsed, but I can call it through cocoon?
I'm still new at using this.
Thank you,
Best Regards,
Luis Carvalho.
--
View this message in context: http://www.nabble.com/Including-a-js-file-tf3936860.html#a11165769
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Including a js file
Posted by lfhc <lu...@gmail.com>.
Worked like a charm.
Many thanks.
Jason Johnston-3 wrote:
>
> lfhc wrote:
>> Hi all,
>> I'm using cocoon to translate an xml file to html, to generate the
>> interface
>> from a content I get from a cms.
>> On that interface I want to include some javascripts such as :
>> ...
>>
>> And I would like this to be allocated within cocoon, since it should
>> handle
>> all that is interface.
>> My problem is that, if I don't register it in the sitemap.xmap file, any
>> call will give me a sitemap.xmap file - Resource not foud.
>> If I set an instance, it will try to parse it, and it is not an xml file.
>> I
>> get the following error :
>>
>> org.xml.sax.SAXParseException: Content is not allowed in prolog.
>> file:/C:/installers/cocoon/cocoon-2.1.10/build/webapp/samples/aggregation/content/prototype.js
>> - 1:1
>>
>> How can I do this, that is, have just a resource for this webapp, that is
>> not parsed, but I can call it through cocoon?
>
>
> It sounds like you want to use a reader[1], specifically the resource
> reader[2]:
>
> <map:match pattern="**.js">
> <map:read src="{1}.js" mime-type="text/javascript" />
> </map:match>
>
>
> [1] http://cocoon.apache.org/2.1/userdocs/readers.html
> [2] http://cocoon.apache.org/2.1/userdocs/default/resource-reader.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Including-a-js-file-tf3936860.html#a11173903
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Including a js file
Posted by Jason Johnston <co...@lojjic.net>.
lfhc wrote:
> Hi all,
> I'm using cocoon to translate an xml file to html, to generate the interface
> from a content I get from a cms.
> On that interface I want to include some javascripts such as :
> ...
>
> And I would like this to be allocated within cocoon, since it should handle
> all that is interface.
> My problem is that, if I don't register it in the sitemap.xmap file, any
> call will give me a sitemap.xmap file - Resource not foud.
> If I set an instance, it will try to parse it, and it is not an xml file. I
> get the following error :
>
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
> file:/C:/installers/cocoon/cocoon-2.1.10/build/webapp/samples/aggregation/content/prototype.js
> - 1:1
>
> How can I do this, that is, have just a resource for this webapp, that is
> not parsed, but I can call it through cocoon?
It sounds like you want to use a reader[1], specifically the resource
reader[2]:
<map:match pattern="**.js">
<map:read src="{1}.js" mime-type="text/javascript" />
</map:match>
[1] http://cocoon.apache.org/2.1/userdocs/readers.html
[2] http://cocoon.apache.org/2.1/userdocs/default/resource-reader.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org