Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Forrest: User

including javascript on a page (help needed)

 

 

Forrest user RSS feed   Index | Next | Previous | View Threaded


metaperl.opensource at gmail

Jun 29, 2006, 7:24 AM

Post #1 of 7 (51 views)
Permalink
including javascript on a page (help needed)

Between a FAQ entry
(http://forrest.apache.org/docs_0_80/faq.html#javascript--- please
note that this FAQ entry contradicts itself. It says that the
directory is skins yet then says the URIs are /skin) and an old email msg (
http://www.mail-archive.com/user [at] forrest/msg00993.html) I tried
to include a hunk of javascript in my 0.7 forrest XML file:

<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "
http://forrest.apache.org/dtd/document-v20.dtd">
<document>
<header>
<title>Magick</title>
</header>
<body>
<section id="live">
<title>Live from Chaosmagic.com</title>

<xi:include src="/skin/chaosmagic.js"/>
</section>


</body>
</document>

However, the error has to do with Forrest not knowing what <xi:include> is:

validate-xdocs:
/C:/Documents%20and%20Settings/Administrator/My%20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:11:46:
Element type "xi:include" must be declared.
/C:/Documents%20and%20Settings/Administrator/My%20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:11:46:
The prefix "xi" for element "xi:include" is not bound.


thorsten.scherler at wyona

Jun 29, 2006, 7:36 AM

Post #2 of 7 (49 views)
Permalink
Re: including javascript on a page (help needed) [In reply to]

El jue, 29-06-2006 a las 11:24 -0400, Terrence Brannon escribió:
> Between a FAQ entry
> (http://forrest.apache.org/docs_0_80/faq.html#javascript --- please
> note that this FAQ entry contradicts itself. It says that the
> directory is skins yet then says the URIs are /skin) and an old email
> msg
> ( http://www.mail-archive.com/user [at] forrest/msg00993.html) I
> tried to include a hunk of javascript in my 0.7 forrest XML file:
>
> <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
> "http://forrest.apache.org/dtd/document-v20.dtd">
> <document>
> <header>
> <title>Magick</title>
> </header>
> <body>
> <section id="live">
> <title>Live from Chaosmagic.com</title>
>
> <xi:include src="/skin/chaosmagic.js"/>
> </section>
>
>
> </body>
> </document>
>
> However, the error has to do with Forrest not knowing what
> <xi:include> is:
>
> validate-xdocs:
> /C:/Documents%20and%20Settings/Administrator/My%
> 20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:11:46: Element type "xi:include" must be declared.
> /C:/Documents%20and%20Settings/Administrator/My%
> 20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:11:46: The prefix "xi" for element "xi:include" is not bound.
>

well this says everything doesn't it? ;)

Have a look at
http://cocoon.apache.org/2.1/userdocs/xinclude-transformer.html
and add xmlns:xi="http://www.w3.org/2001/XInclude" to the document tag
like:
<document xmlns:xi="http://www.w3.org/2001/XInclude">

HTH

salu2
--
Thorsten Scherler
COO Spain
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
thorsten.scherler [at] wyona thorsten [at] apache


rgardler at apache

Jun 29, 2006, 8:11 AM

Post #3 of 7 (49 views)
Permalink
Re: including javascript on a page (help needed) [In reply to]

Terrence Brannon wrote:
> Between a FAQ entry
> (http://forrest.apache.org/docs_0_80/faq.html#javascript --- please note
> that this FAQ entry contradicts itself. It says that the directory is
> skins yet then says the URIs are /skin)

This is not a contrdition it is a correct statement. Forrest does not
force the URL space to be the same as the development structure. So
"skin/" can be mapped to anywhere that is accessible to the computer
(including a remote resource). In the default setting it is mapped to
the FORREST_HOME/webapp/skins.

Why do this? There are many reasons. One is the fact that not all
developers would want to work with an English project structure. The URL
snippet "skin/foo" may be mapped to "pelle/bar", for example (I believe
pelle is Italian for skin).

Your other points have been addressed by Thorsten.

Ross


metaperl.opensource at gmail

Jun 29, 2006, 10:14 AM

Post #4 of 7 (49 views)
Permalink
Re: including javascript on a page (help needed) [In reply to]

On 6/29/06, Thorsten Scherler <thorsten.scherler [at] wyona> wrote:
>
>
> add xmlns:xi="http://www.w3.org/2001/XInclude" to the document tag
> like:
> <document xmlns:xi="http://www.w3.org/2001/XInclude">


Actually, it is still failing. Here is the document:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "
http://forrest.apache.org/dtd/document-v20.dtd">
<document xmlns:xi="http://www.w3.org/2001/XInclude">
<header>
<title>Magick</title>
</header>
<body>
<section id="live">
<title>Live from Chaosmagic.com</title>
<xi:include href="/skins/chaosmagic.js"/>
</section>
</body>
</document>

And here are the reported build errors:
validate-xdocs:
/C:/Documents%20and%20Settings/Administrator/My%20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:3:54:
Attribute "xmlns:xi" must be declared for element type "document".
/C:/Documents%20and%20Settings/Administrator/My%20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:10:48:
Element type "xi:include" must be declared.
/C:/Documents%20and%20Settings/Administrator/My%20Documents/domains/org/livingcosmos/dev/src/documentation/content/xdocs/magick.xml:11:15:
The content of element type "section" must match
"(title,(section|p|source|note|warning|fixme|table|ol|ul|dl|figure|anchor)*)".

BUILD FAILED

==========================
Finally, I'd like to make sure that this directory tree looks fine assuming
I have made not modes to forrest.properties:
c:\Documents and Settings\Administrator\My
Documents\domains\org\livingcosmos\dev\src\documentation:
total 28
drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 .
drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 ..
drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 classes
drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 content
-rw-rw-rw- 1 Administrator 0 353 Jun 29 10:29 README.txt
drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 resources
-rw-rw-rw- 1 Administrator 0 2606 Jun 29 10:29 sitemap.xmap
-rw-rw-rw- 1 Administrator 0 17891 Jun 29 10:29 skinconf.xml
drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 skins
drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 translations

c:\Documents and Settings\Administrator\My
Documents\domains\org\livingcosmos\dev\src\documentation\skins:
total 4
drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 .
drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 ..
-rw-rw-rw- 1 Administrator 0 2178 Jun 29 11:10 chaosmagic.js


metaperl.opensource at gmail

Jun 29, 2006, 11:25 AM

Post #5 of 7 (49 views)
Permalink
Re: including javascript on a page (help needed) [In reply to]

On 6/29/06, Terrence Brannon <metaperl.opensource [at] gmail> wrote:
>
>
>
> On 6/29/06, Thorsten Scherler <thorsten.scherler [at] wyona> wrote:
> >
> >
> > add xmlns:xi="http://www.w3.org/2001/XInclude" to the document tag
> > like:
> > <document xmlns:xi="http://www.w3.org/2001/XInclude ">
>
>
> Actually, it is still failing.
>

I'm thinking that something needs to be added to the sitemap.xmap, but I am
not sure exactly how to do so.


crossley at apache

Jun 29, 2006, 7:03 PM

Post #6 of 7 (49 views)
Permalink
Re: including javascript on a page (help needed) [In reply to]

Terrence Brannon wrote:
> <header>
> <title>Magick</title>
> </header>
> <body>
> <section id="live">
> <title>Live from Chaosmagic.com</title>
> <xi:include href="/skins/chaosmagic.js"/>
> </section>
> </body>
> </document>

I think that you are on the wrong track there.
You could perhaps try turn off xml validation
in forrest.properties for that particular page.

The FAQ is vague on this.
http://forrest.apache.org/faq.html#javascript

It does say that the URI must be /skin/chaosmagic.js

It does not tell you how to get the "script" element and
attributes through to the output html, either in the
head or the body. Sorry i don't know the answer, but
see below.

I think that the FAQ really talks about skin-specific
javascript and css for enhancing the "pelt" skin
or creating your own.

So you could probably tweak the stylesheets in
$FORREST_HOME/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl
to hack a reference to your .js files. That would
be site-wide not page-specific.

Back to the "script" element ...
That is not present in the Xdoc schema (DTD). I am not
familiar with "script" in xhtml2, but if the behaviour
is the same, then we can perhaps add it to the xdoc DTD.

Then you could follow the sitemap processing of the
"meta" element to develop a similar procedure for
getting page-specific "head/script" elements through
to html output.

Also there might be other mechanisms using the new
Dispatcher capability in future versions of Forrest.

> ==========================
> Finally, I'd like to make sure that this directory tree looks fine assuming
> I have made not modes to forrest.properties:

As long as Forrest can read the files. It would need write access
to the livingcosmos\dev\build directory (or wherever you defined it).

> c:\Documents and Settings\Administrator\My
> Documents\domains\org\livingcosmos\dev\src\documentation:
> total 28
> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 .
> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 ..
> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 classes
> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 content
> -rw-rw-rw- 1 Administrator 0 353 Jun 29 10:29 README.txt
> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 resources
> -rw-rw-rw- 1 Administrator 0 2606 Jun 29 10:29 sitemap.xmap
> -rw-rw-rw- 1 Administrator 0 17891 Jun 29 10:29 skinconf.xml
> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 skins
> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 translations
>
> c:\Documents and Settings\Administrator\My
> Documents\domains\org\livingcosmos\dev\src\documentation\skins:
> total 4
> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 .
> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 ..
> -rw-rw-rw- 1 Administrator 0 2178 Jun 29 11:10 chaosmagic.js

This doesn't look correct. Which skin are you using?
If the default "pelt" then
src\documentation\skins\pelt\scripts\chaosmagic.js

The FAQ does specify this.

-David


holly at edelsonmedia

Jun 30, 2006, 8:59 AM

Post #7 of 7 (49 views)
Permalink
Re: including javascript on a page (help needed) [In reply to]

David Crossley wrote:
> Terrence Brannon wrote:
>
>> <header>
>> <title>Magick</title>
>> </header>
>> <body>
>> <section id="live">
>> <title>Live from Chaosmagic.com</title>
>> <xi:include href="/skins/chaosmagic.js"/>
>> </section>
>> </body>
>> </document>
>>
>
> I think that you are on the wrong track there.
> You could perhaps try turn off xml validation
> in forrest.properties for that particular page.
>
> The FAQ is vague on this.
> http://forrest.apache.org/faq.html#javascript
>
> It does say that the URI must be /skin/chaosmagic.js
>
> It does not tell you how to get the "script" element and
> attributes through to the output html, either in the
> head or the body. Sorry i don't know the answer, but
> see below.
>
> I think that the FAQ really talks about skin-specific
> javascript and css for enhancing the "pelt" skin
> or creating your own.
>
> So you could probably tweak the stylesheets in
> $FORREST_HOME/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl
> to hack a reference to your .js files. That would
> be site-wide not page-specific.
>
I have this solution implemented in a custom site2xhtml running on a
live site,
but do want to find a targeted xinclude solution as what Thorsten laid out.
I tried months ago to solve it in sitemap then deferred to waiting for
Dispatcher O:-)

Also tried to customize the schema for this and other solutions, but
webapp/* kept stripping it
and I couldn't find the root in webapp/* that was controlling this. it
wasn't the dtd's. Must be
hiding out in the 0.7 skin stylesheets.
Been working on some of this past few months, will note on dev when
(if!!) I get it.

Holly (Helena)
> Back to the "script" element ...
> That is not present in the Xdoc schema (DTD). I am not
> familiar with "script" in xhtml2, but if the behaviour
> is the same, then we can perhaps add it to the xdoc DTD.
>
> Then you could follow the sitemap processing of the
> "meta" element to develop a similar procedure for
> getting page-specific "head/script" elements through
> to html output.
>
> Also there might be other mechanisms using the new
> Dispatcher capability in future versions of Forrest.
>
>
>> ==========================
>> Finally, I'd like to make sure that this directory tree looks fine assuming
>> I have made not modes to forrest.properties:
>>
>
> As long as Forrest can read the files. It would need write access
> to the livingcosmos\dev\build directory (or wherever you defined it).
>
>
>> c:\Documents and Settings\Administrator\My
>> Documents\domains\org\livingcosmos\dev\src\documentation:
>> total 28
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 .
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 ..
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 classes
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 content
>> -rw-rw-rw- 1 Administrator 0 353 Jun 29 10:29 README.txt
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 resources
>> -rw-rw-rw- 1 Administrator 0 2606 Jun 29 10:29 sitemap.xmap
>> -rw-rw-rw- 1 Administrator 0 17891 Jun 29 10:29 skinconf.xml
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 skins
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 10:29 translations
>>
>> c:\Documents and Settings\Administrator\My
>> Documents\domains\org\livingcosmos\dev\src\documentation\skins:
>> total 4
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 .
>> drwxrwxrwx 2 Administrator 0 0 Jun 29 11:10 ..
>> -rw-rw-rw- 1 Administrator 0 2178 Jun 29 11:10 chaosmagic.js
>>
>
> This doesn't look correct. Which skin are you using?
> If the default "pelt" then
> src\documentation\skins\pelt\scripts\chaosmagic.js
>
> The FAQ does specify this.
>
> -David
>
>
>

Forrest user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.