You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Sean Wheller <se...@enbaya.co.za> on 2004/10/02 16:32:07 UTC
map:transform to docbook xsl
Hi,
Patience with me. I am trying to get forrest to use the nwalsh docbook
stylesheets directly as per
http://localhost:8888/faq.html#docbook
I have created project src/documentation/sitemap.xmap
START ~~~~~~~~~~~~~~~~~~~~
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="db-**.xml">
<map:generate src="{project:content.xdocs}db-{1}.xml" />
<map:transform
src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/html/docbook.xsl" />
<map:serialize/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
END ~~~~~~~~~~~~~~~~~~~~
This results in the following being return
START ~~~~~~~~~~~~~~~~~~~~
Internal Server Error
Message: null
Description: No details available.
Sender: org.apache.cocoon.servlet.CocoonServlet
Source: Cocoon Servlet
Request URI
db-article.html
cause
java.lang.NullPointerException
request-uri
/db-article.html
Apache Cocoon 2.2.0-dev
END ~~~~~~~~~~~~~~~~~~~~
If I change this to use (xhtml) like this
<map:transform
src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/xhtml/docbook.xsl" />
Then a blank body is returned
START ~~~~~~~~~~~~~~~~~~~~
<!--+
|alternative credits
+-->
</div>
<!--+
|end Menu
+-->
<!--+
|start content
+-->
<!--+
|end content
+-->
<div class="clearboth"> </div>
END ~~~~~~~~~~~~~~~~~~~~
I am probably missing something simple, but as a newbie to forrest I dont know
what and cant fin the answer in the docs which I find tends to break things
into a 100 pieces. Thanks for any help.
--
Sean Wheller
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
I cannot see what is wrong with your setup Sean.
It looks okay. Anyway it works for me ...
Added a file to a forrest seed site.
xdocs/resolver-article.xml
Added an entry to site.xml
Used the following sitemap.xmap ...
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="**/resolver-*.html">
<map:generate src="{project:content.xdocs}{1}/resolver-{2}.xml"/>
<map:transform
src="file:///usr/share/sgml/docbook/xsl/xhtml/docbook.xsl"/>
<map:serialize/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
--
David Crossley
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
Sean Wheller wrote:
> David Crossley wrote:
> >
> > The project sitemap needs to handle the request to
> > the db-*.html and not the *.xml as you have.
>
> Ok I see now. It looks for a request for any file db-*.html as that is what is
> shown in the menu link. Now all I need is for the article to to be genrated
> through a custom layer and of course to make it fall within body. At present
> it is just a raw article and the user no longer sees the forrest menu, footer
> etc.
Yes, that "raw" output is the intended behaviour. You have
intercepted the request for the DocBook documents with your
project sitemap and are doing the complete transformation
into XHTML with the DocBook XSL, serialising it as XHTML.
> > Your doc works with my sitemap. We look for to seeing
> > your articles on-line shortly.
>
> Yes. Actually I am slowly finding my way around the forrest.
> I plan to take a look at docbooktodocument and see if I can
> add template to match xref and perhaps improve a bit.
Any improvements to that fallback processing are welcome.
This is good for people who have simple docbook files and
who don't want to use the full DocBook XSL.
--
David Crossley
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
On Sunday 03 October 2004 14:38, David Crossley wrote:
> I sent another message today, after the one that you refer to,
> to say that it works for me and i provided my sitemap.
> However, i have since discovered that my project sitemap
> was not handling it and so i was getting the default Forrest
> minimal docbook.
Yes, I got your earlier message. I just replied to the first.
>
> I have since fixed it and everything now works for me.
> Updated sitemap at:
> http://forrest.apache.org/faq.html#docbook
>
> However your sitemap doesn't work. And now i see why.
> You must be not quite understanding how the sitemap works
> (or you just have a typo).
>
> The project sitemap needs to handle the request to
> the db-*.html and not the *.xml as you have.
Ok I see now. It looks for a request for any file db-*.html as that is what is
shown in the menu link. Now all I need is for the article to to be genrated
through a custom layer and of course to make it fall within body. At present
it is just a raw article and the user no longer sees the forrest menu, footer
etc.
>
> Your doc works with my sitemap. We look for to seeing
> your articles on-line shortly.
Yes. Actually I am slowly finding my way around the forrest. I plan to take a
look at docbooktodocument and see if I can add template to match xref and
perhaps improve a bit.
--
Sean Wheller
Technical Author
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
On Monday 04 October 2004 03:08, David Crossley wrote:
> Sean Wheller wrote:
> > David, when you access the article does forrest apply the default skin.
>
> Yes, and that is the intended behaviour.
No, it does not default to this behavior. I think one still has to pass the
output to a new pipe. As you explained below.
>
> > Unless
> > I understand the docs wrong when it says ...
> >
> > "That will intercept the request for the body content, for only this
> > specific "download" document, and will transform it into the intermediate
> > Forrest "document" format. The normal Forrest machinery will handle the
> > aggregation with navigation menus etc. and will apply the normal skin."
> > From:
> > http://forrest.apache.org/docs/your-project.html#adding_new_content_type
>
> You are getting confused. That section is about advanced
> customisations which transform into the intermediate Forrest
> "document-v* DTD" format. Your project sitemap is doing
> the "complete" transformation using the DocBook XSL.
You lost my meaning, but it's not important, I understand what you mean.
>
> > Essentially, my sitemap.xmap is not that different to the one provided in
> > the example "adding_new_content_type".
>
> It is very different. The latter delivers output as
> the intermediate Forrest format. The former delivers
> final html.
True. The resulting output format is different.
[snip] > > So if I am not mistaken,
...
[snip] You are...
[snip] random thought.
--
Sean Wheller
Technical Author
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
On Monday 04 October 2004 03:08, David Crossley wrote:
> Going into Random Thought (RT) mode now ...
>
> We have not yet had time to explore this because the
> "project sitemap" capability is very new. There might
> be a way to get the full DocBook XSL processing *AND*
> adorned with the Forrest navigation bits.
>
> Add an extra transformation after the DocBook one to use
> core/context/resources/stylesheets/html2document.xsl
>
> However in this case, i wonder if the project sitemap
> needs to match on the "db-*.xml" pattern. Not sure.
>
> I am sorry that i cannot help much more, but my open source
> time is going toward getting the 0.6 release out.
>
> Anyway please persist. This would be a very important
> capability that many people would be interested in.
I will test this and post what works.
--
Sean Wheller
Technical Author
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
Sean Wheller wrote:
> David Crossley wrote:
> > > > David Crossley wrote:
> > > > > Add an extra transformation after the DocBook one to use
> > > > > core/context/resources/stylesheets/html2document.xsl
<snip/>
>
> Adding another map:transform does nothing but bring up a part of the HTML
> output from the docbook.xsl
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
> Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
> <document>
> <header>
> <title>XML Solves Tech Publishing Problems</title> <!-- <meta content="DocBook
> XSL Stylesheets V1.64.1" name="generator"> --> </header>
> <body></body>
> </document>
>
> As you see BODY is blank.
Which is correct, according to your sitemap.
This shows that you still have not quite grasped
the sitemap behaviour. (I did point this out already,
but i understand that comments are easy to miss in
the volume.)
You are erroneously matching the db-article.html
and therefore handling *every part* of the processing
in your project sitemap. So you are transforming the
output from the DocBook XSL into Forrest "document-v*"
and sending that to the browser.
Instead, see my sitemap below.
> The sitemap looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="db-*.html">
> <map:generate src="{project:content.xdocs}db-{1}.xml"/>
> <map:transform
> src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/html/docbook.xsl"/>
> <map:transform
> src="/home/sean/projects/forrest/src/core/context/resources/stylesheets/html2document.xsl"/>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
> Did you mean to add the map:transform here?
Yes, that is the correct place. However you need
the following sitemap. Note my match for db-*.xml
This is because we need to supply content for the
"body" section. Look at core/context/sitemap.xmap
(at today's SVN revision for it, i.e. 47180).
Around line 582 it aggregates all the pieces: skinconf,
tab, menu, and body. For the "body" it sends a request
for cocoon:/body-db-article.html which gets matched at
line 493. This then generates the raw content for body
using the request cocoon:/db-article.xml which would
normally be matched at line 384. This is where we
intercept the *.xml request with our project sitemap.
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="db-*.xml">
<map:generate src="{project:content.xdocs}db-{1}.xml"/>
<map:transform
src="file:///usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl"/>
<map:transform src="{forrest:stylesheets}/html2document.xsl"/>
<map:serialize type="xml-document"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
This does what we want. However, it reveals a similar glitch
with the empty body content.
I think that i may have found the issue. The DocBook XSL
is generating the page with <div> containers. Fair enough.
However, the html2document.xsl is not expecting divs.
The problem can be duplicated in the "forrest seed" site,
by adding a div container to samples/ihtml-sample.ihtml
Anyway, i get the feeling that this is not a good solution.
We are replacing one workaround (docbook2document.xsl) with
another workaround (html2document.xsl). Is it better?
It is probably worth persisting, if only as an exercise
to help you (and others, and me) to understand the sitemap.
--
David Crossley
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
On Monday 04 October 2004 09:10, David Crossley wrote:
> > > David Crossley wrote:
> > > > Add an extra transformation after the DocBook one to use
> > > > core/context/resources/stylesheets/html2document.xsl
> > >
> > > You might also need ...<map:serialize type="html"/>
> >
> > Will test this.
David,
Adding another map:transform does nothing but bring up a part of the HTML
output from the docbook.xsl
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<document>
<header>
<title>XML Solves Tech Publishing Problems</title> <!-- <meta content="DocBook
XSL Stylesheets V1.64.1" name="generator"> --> </header>
<body></body>
</document>
As you see BODY is blank.
The sitemap looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="db-*.html">
<map:generate src="{project:content.xdocs}db-{1}.xml"/>
<map:transform
src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/html/docbook.xsl"/>
<map:transform
src="/home/sean/projects/forrest/src/core/context/resources/stylesheets/html2document.xsl"/>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
Did you mean to add the map:transform here?
The aim here is to have a document with all forrest adorning.
I have tried several configurations with a seed project sitemap, but nothing
happens.
--
Sean Wheller
Technical Author
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
Sean Wheller wrote:
> David Crossley wrote:
> > David Crossley wrote:
> > > Add an extra transformation after the DocBook one to use
> > > core/context/resources/stylesheets/html2document.xsl
> >
> > You might also need ...<map:serialize type="html"/>
>
> Will test this.
>
> As I understand, <map:serialize type="html"/> = <map:serialize/> since cocoon
> uses its' HTML Serializer as default. I also see that HTML is specified
> "default" in forrest.
>
> So no need to specify, uless you want one of the other serializers, XML, PDF,
> TXT, SVG.
... or XHTML, or your own serializer defined as xhtml
with different document type declarations.
What you say is correct. I should have been more explicit.
Your "raw" DocBook generation with the previous sitemap
was using the XHTML stylesheets, so i thought that you
would probably be serialising to xhtml.
Why i mentioned it was that when you are aggregating internal
pipelines the serializer might need to be different.
--
David Crossley
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
On Monday 04 October 2004 04:21, David Crossley wrote:
> David Crossley wrote:
> > Add an extra transformation after the DocBook one to use
> > core/context/resources/stylesheets/html2document.xsl
>
> You might also need ...<map:serialize type="html"/>
Will test this.
As I understand, <map:serialize type="html"/> = <map:serialize/> since cocoon
uses its' HTML Serializer as default. I also see that HTML is specified
"default" in forrest.
So no need to specify, uless you want one of the other serializers, XML, PDF,
TXT, SVG.
--
Sean Wheller
Technical Author
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
David Crossley wrote:
>
> Add an extra transformation after the DocBook one to use
> core/context/resources/stylesheets/html2document.xsl
You might also need ...<map:serialize type="html"/>
--
David Crossley
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
Sean Wheller wrote:
> David, when you access the article does forrest apply the default skin.
Yes, and that is the intended behaviour.
> Unless
> I understand the docs wrong when it says ...
>
> "That will intercept the request for the body content, for only this specific
> "download" document, and will transform it into the intermediate Forrest
> "document" format. The normal Forrest machinery will handle the aggregation
> with navigation menus etc. and will apply the normal skin."
> From: http://forrest.apache.org/docs/your-project.html#adding_new_content_type
You are getting confused. That section is about advanced
customisations which transform into the intermediate Forrest
"document-v* DTD" format. Your project sitemap is doing
the "complete" transformation using the DocBook XSL.
> Essentially, my sitemap.xmap is not that different to the one provided in the
> example "adding_new_content_type".
It is very different. The latter delivers output as
the intermediate Forrest format. The former delivers
final html.
> So if I am not mistaken, forrest machinery
> should "handle the aggregation with navigation menus etc. and will apply the
> normal skin."
>
> Or am I missing something else?
:-) You are, as explain above.
Going into Random Thought (RT) mode now ...
We have not yet had time to explore this because the
"project sitemap" capability is very new. There might
be a way to get the full DocBook XSL processing *AND*
adorned with the Forrest navigation bits.
Add an extra transformation after the DocBook one to use
core/context/resources/stylesheets/html2document.xsl
However in this case, i wonder if the project sitemap
needs to match on the "db-*.xml" pattern. Not sure.
I am sorry that i cannot help much more, but my open source
time is going toward getting the 0.6 release out.
Anyway please persist. This would be a very important
capability that many people would be interested in.
--
David Crossley
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
David, when you access the article does forrest apply the default skin. Unless
I understand the docs wrong when it says ...
"That will intercept the request for the body content, for only this specific
"download" document, and will transform it into the intermediate Forrest
"document" format. The normal Forrest machinery will handle the aggregation
with navigation menus etc. and will apply the normal skin."
From: http://forrest.apache.org/docs/your-project.html#adding_new_content_type
Essentially, my sitemap.xmap is not that different to the one provided in the
example "adding_new_content_type". So if I am not mistaken, forrest machinery
should "handle the aggregation with navigation menus etc. and will apply the
normal skin."
Or am I missing something else?
--
Sean Wheller
Technical Author
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
(There is no need to Cc to me, just to the list will do.)
I sent another message today, after the one that you refer to,
to say that it works for me and i provided my sitemap.
However, i have since discovered that my project sitemap
was not handling it and so i was getting the default Forrest
minimal docbook.
I have since fixed it and everything now works for me.
Updated sitemap at:
http://forrest.apache.org/faq.html#docbook
However your sitemap doesn't work. And now i see why.
You must be not quite understanding how the sitemap works
(or you just have a typo).
The project sitemap needs to handle the request to
the db-*.html and not the *.xml as you have.
Your doc works with my sitemap. We look for to seeing
your articles on-line shortly.
--
David Crossley
Re: map:transform to docbook xsl
Posted by Sean Wheller <se...@inwords.co.za>.
On Sunday 03 October 2004 03:31, David Crossley wrote:
> > Patience with me. I am trying to get forrest to use the nwalsh docbook
> > stylesheets directly as per
> > http://localhost:8888/faq.html#docbook
>
> And then following the general notes for adding
> project sitemaps in the "Using Forrest" document
> and the "Project Sitemaps" document.
>
> I presume that you are using the Forrest-0.6-dev
> SVN trunk.
Yes. I have followed these instructions over and over and yes I use SVN
trunk.
Just to make sure. I ripped forrest out, then:
1. did svn checkout of trunk
2. ./build.sh (succeed) env was already set.
3. create new dir and forrest seed (works)
4. execute forrest run from root of new seed project to text if I can see the
proj, I can. Stop Jetty.
5. Add to site.xml
<about label="Documents">
<index label="XML Solves Problems" href="db-article.html"
description="XML Solves Tech Publishing Problems"/>
</about>
7. cp db-article.xml to seed project xdocs/
8. forrest run. I see changes to menu.
9. Click "XML Solves Problems" db-article.xml is transformed to document
(default docbooktodocument.xsl). Stop jetty.
10. Write new sitemap.xmap saved to documentation/sitemap.xmap
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="db-**.xml">
<map:generate src="{project:content.xdocs}db-{1}.xml"/>
<map:transform
src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/xhtml/docbook.xsl"/>
<map:serialize/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
No need to register the docbook dtd since forrest ships with it and it is
already configured in forrest.xmap.
<sourcetype name="docbook-v4.2">
<document-declaration public-id="-//OASIS//DTD DocBook XML
V4.2//EN" />
</sourcetype>
I understand the the sitemap.xmap in see documentation/ will take precedence
over forrest.xmap
<map:when test="docbook-v4.2">
<map:transform src="{forrest:stylesheets}/docbook2document.xsl" />
</map:when>
11. Forrest run and try to see the db-article. NO LUCK:-( Just a blank body.
As explained in previous message.
Thanks for your help. If you have any other questions, let me know.
I am considering using Forrest for a new Open Source project and really want
it to work as all sources are in docbook xml. I get this right, I will update
the forrest docs and send a patch.
Attached is the db-article.xml for you to test.
--
Sean Wheller
Technical Author
084-8549408
sean@inwords.co.za
http://www.inwords.co.za
Re: map:transform to docbook xsl
Posted by David Crossley <cr...@apache.org>.
Sean Wheller wrote:
> Patience with me. I am trying to get forrest to use the nwalsh docbook
> stylesheets directly as per
> http://localhost:8888/faq.html#docbook
And then following the general notes for adding
project sitemaps in the "Using Forrest" document
and the "Project Sitemaps" document.
I presume that you are using the Forrest-0.6-dev
SVN trunk.
> I have created project src/documentation/sitemap.xmap
>
> START ~~~~~~~~~~~~~~~~~~~~
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="db-**.xml">
> <map:generate src="{project:content.xdocs}db-{1}.xml" />
> <map:transform
> src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/html/docbook.xsl" />
> <map:serialize/>
> </map:match>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
> END ~~~~~~~~~~~~~~~~~~~~
I hope that you also have the first line
as the normal xml declaration ... <?xml ...
> This results in the following being return
>
> START ~~~~~~~~~~~~~~~~~~~~
>
> Internal Server Error
>
> Message: null
>
> Description: No details available.
>
> Sender: org.apache.cocoon.servlet.CocoonServlet
>
> Source: Cocoon Servlet
>
> Request URI
>
> db-article.html
>
> cause
>
> java.lang.NullPointerException
>
> request-uri
>
> /db-article.html
>
> Apache Cocoon 2.2.0-dev
> END ~~~~~~~~~~~~~~~~~~~~
>
> If I change this to use (xhtml) like this
> <map:transform
> src="/usr/share/xml/docbook/stylesheet/nwalsh/1.64.1/xhtml/docbook.xsl" />
>
> Then a blank body is returned
> START ~~~~~~~~~~~~~~~~~~~~
> <!--+
> |alternative credits
> +-->
> </div>
> <!--+
> |end Menu
> +-->
> <!--+
> |start content
> +-->
> <!--+
> |end content
> +-->
> <div class="clearboth"> </div>
> END ~~~~~~~~~~~~~~~~~~~~
>
> I am probably missing something simple, but as a newbie to forrest I dont know
> what and cant fin the answer in the docs which I find tends to break things
> into a 100 pieces. Thanks for any help.
I will try to follow the procedure later today.
--
David Crossley