forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject AW: Forrest: responses
Date Tue, 04 Mar 2003 15:51:07 GMT
On my page I create a PDF of the whole site.

In my sitemap I added

  <map:resource name="aggregate2document">
   <map:transform src="skins/{defaults:skin}/xslt/aggregate2document.xsl">
     <map:parameter name="title" value="{title}"/>


  <!-- MAT: Die komplette Site. Zur Erzeugung der site.pdf und der
fixme-Auflistung -->
  <map:match pattern="MoerserBlechblaesertageDE.xml">
    <map:aggregate element="aggregate">
        <map:part src="content/xdocs/index.xml"/>
        <map:part src="content/xdocs/aenderungen.xml"/>
        <map:part src="content/xdocs/impressum.xml"/>
        <map:part src="content/xdocs/programmvorschau.xml"/>
        <map:part src="content/xdocs/musikgruppen.xml"/>
        <map:part src="content/xdocs/historie.xml"/>
        <map:part src="content/xdocs/kuenstler.xml"/>
        <map:part src="content/xdocs/unterstuetzung.xml"/>
        <map:part src="cocoon:/pressespiegel.xml"/>
        <map:part src="content/xdocs/technologie.xml"/>
    <map:call resource="aggregate2document">
      <map:parameter name="title" value="Die Moerser Blechbläsertage"/>

  <!-- PDF der ganzen Site -->
  <map:match pattern="MoerserBlechblaesertageDE.pdf">
    <map:generate src="cocoon:/MoerserBlechblaesertageDE.xml"/>
    <map:transform src="skins/{defaults:skin}/xslt/fo/document2fo.xsl"/>
    <map:serialize type="fo2pdf"/>

The second match lets Cocoon do the PDF generation. Its source is an
internal (cocoon:/)
source, which is match by the first <map:match/>. There I have an aggregate
of my site.
(more comfortable would be evaluating the site.xml or the diverse book.xml)
For "pressespiegel" I have to do a <map:part
src="cocoon:/pressespiegel.xml"/> (internal
request) because its a custom DTD.

Because all documents are valid document-v11 and the result not (I think), I
have created
a stylesheet which I called after aggregation. Because I want to give a
parameter, I created
a resource.
The stylesheet creates a new document with the title provided as parameter.
For each aggregated
document it creates a first level <section> with the title of the document.
The <head> areas of
the aggregated documents are deleted and their <body> is converted to
<section> (as I said).
The rest is copied.

Maybe not the best solution, but it works.

Mmmm, the PDF is corrumpted while upload ...
In the next day you can try it from:

If someone wants it, here the stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- If multiple documents are aggregated via <map:aggregate> in the sitemap
<!-- this stylesheet converts the result into a (hopefully) valid document.
<!-- Prerequisite: aggregate labeled as "aggregate":
<!--     <map:aggregate label="aggregate">
<!--         <map:part/> ...
<!-- This stylesheet accesses an optional parameter "title" which is uses
<!-- for generating the document/header/title-element for the new document.

<xsl:stylesheet version="1.0"

  <xsl:param name="title"/>

<!-- Entry point -->
<xsl:template match="/aggregate">
    <xsl:if test="$title">
        <title><xsl:value-of select="$title"/></title>
         <!-- anchor, so you can jump to the top of the page -->
         <anchor id="_top_"/>



<!-- Use the document title as title for the section -->
<xsl:template match="document">
        <title><xsl:value-of select="header/title"/></title>
        <xsl:apply-templates select="body" />

<!-- Delete the body tag -->
<xsl:template match="body">

<!-- Delete the _top_-anchors, because only one per document is permitted.
<xsl:template match="anchor">
    <xsl:if test="@id != '_top_'">
        <xsl:call-template name="copy-all"/>

<!-- Include all other nodes, ... -->
<xsl:template match="node()|@*" priority="-1" name="copy-all">
        <xsl:apply-templates select="@*"/>


Thanks for Forrest. :-)

Jan Matèrne

-----Ursprüngliche Nachricht-----
Von: Tom Klaasen []
Gesendet am: Dienstag, 4. März 2003 16:34
Betreff: Forrest: responses

I've used Forrest to build some documentation for my client. I've presented
it to some people already, and all reactions were "ooohh..." and
"aaaahh....". Some even asked where they could find this tool, so they could
play with it themselves. And those are not Java people! Great.

When I present Forrest, I start with "it's a site", and "it's generated from
xml". "You put your xml through a command line tool, and then you get this
html". Occasionally, I change the skin, rebuild, and get some more "ooohhh".
But the final feature that makes them go "I want that" is the
auto-generation of the PDF files. Great, they think, two files with the
effort of typing one. And right they are :-)

The only thing that looks like a drawback (give a finger, and they'll want
an arm) is that all PDFs are per-page. It's not (yet?) possible to generate
one big PDF from the whole of the site. It's on Forrest's Dream List though,
so I keep my hopes up that it will get there some day. In the mean time,
I've quickly pondered what difficulties would come up when you implement
something like that, and it didn't look too easy. You'd have to build a PDF
file while crawling the site, instead of just aggregating a static
collection of PDF pipelines. At least, that's how it looks from the outside.
And that is probably the reason that it's not implemented yet. Ah, time,
sweet time...

But overall: fantastic job, Forresteers. You really made it possible to
concentrate on content instead of fighting with the text editor's whims.


Thanks, people!


View raw message