forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Brown <mr...@twdata.org>
Subject Re: Building sections as PDF
Date Thu, 02 Oct 2003 21:52:11 GMT
I followed Jeff's advice and am using a custom sitemap.xmap and
aggregate.xmap.  My goal is to let tabs be built as PDFs just as the whole
site is.  A couple of questions (sorry, I would normally post these on
*-user):

 - The xpath transformer preserves the ancestors of the selected node,
which screws up the PDF numbering system.  If I chose //foo, I'd like foo
to be the root of the new book and its children the chapters.  I solved
this by using an identity xslt that copies "site", but cuts the rest out.
Could this be an option in the xpath transformer or would it make it too
Forrest specific?

 - To tell Forrest I wanted a PDF of a tab, I used site-*.xml where {1} is
the tab name.  Unfortunately, due to the limitations of xslt (in
particular starts-with(), the link to the PDF has to be in a section with
no inherited href.  Say the tab's files are in foo/.  If I put a link to
the pdf in the tab's menu, it makes foo/site-foo.xml which screws up the
starts-with().  I can't think of a work-around for this one.

 - I'd like the title of the tab's PDF to be the tab's label.  Why doesn't
site2book.xsl keep the label of the root node?  The "book" element doesn't
use the label attribute so it could be saved there.  If so, then
book2cinclude.xsl could, be default, use /book/@label as the title.  This
allows tab PDF's to have the correct title without hard-coding it in the
sitemap pipeline.  This same process could be applicable to the title for
the site's PDF using the /site/@label as the default title.

Am I going about things the hard way and missing something easy?  Thanks
for the help.  If the discussed changes are approved, I wouldn't mind
whipping up some patches.

Don

 On Thu, 2 Oct 2003, Jeff Turner wrote:

> On Wed, Oct 01, 2003 at 04:57:58PM -1000, Don Brown wrote:
> > In the FAQ, there is a question about building the whole site or selected
> > pages as PDF.  While the answer covers building the whole site as PDF, as
> > far as I can tell, it is not possible, without touching sitemaps, to
> > generate sections or tabs as PDF.
> >
> > Jeff seems to hint at possible solutions in the future,
> > http://marc.theaimsgroup.com/?l=forrest-dev&m=105516618908652&w=2, but I
> > didn't see anything after that.
>
> The mechanics are all in place.  It just requires a bit of sitemap
> hacking.
>
> If you look in aggregate.xmap, you'll see how the whole-site PDF works:
>
>  <!-- Aggregation of all XML in the site -->
>  <map:match pattern="*.xml">
>    <map:generate src="cocoon://abs-linkmap"/>
>    <map:transform src="resources/stylesheets/site2book.xsl" />
>    <map:transform src="resources/stylesheets/aggregates/book2cinclude.xsl">
>      <map:parameter name="ignore" value="{1}"/>
>      <map:parameter name="title" value="{conf:project-name} Documentation"/>
>    </map:transform>
>    <map:transform type="cinclude"/>
>    <map:transform src="resources/stylesheets/aggregates/doc2doc-uniqueids.xsl"/>
>    <map:transform src="resources/stylesheets/aggregates/docs2document.xsl"/>
>    <map:serialize type="xml"/>
>  </map:match>
>
> If you view cocoon://abs-linkmap ('forrest run', then
> http://localhost:8888/abs-linkmap), you'll see it is a normalized view of
> site.xml, listing each page in the site.  You could trim that XML down to just
> the required section with:
>
>  <map:transform type="xpath">
>    <map:parameter name="include" value="//some/section/*" />
>  </map:transform>
>
> (that being an XPath matching nodes to let through; see XPathTransformer.java
> for details)
>
> The pipeline with this modification could then be saved in sitemap.xmap,
> matching the pattern 'usermanual.xml' or whatever.
>
> Does that give you enough to go on?  I could whip up a sample if you
> like.
>
>
> Cheers,
>
> --Jeff
>
>
> >
> > Am I missing something?
> >
> > Don
> >
>


Mime
View raw message