forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: Hiding sections
Date Tue, 21 Mar 2006 00:13:37 GMT
Flavio Cordova wrote:
> Is there a way to set any attribute (or something else) to a section
> so I could omit it when using forrest site or forrestbot, based on a
> parameter ?

Forrestbot is just an automated way to run "forrest site".

> Today I use forrest to create an application's user manual. Most of
> the information I use to create this documentation is based on use
> cases specifications, but this specification has some information that
> aren't appropriated to end users. So today I keep two different
> documents, one for developers and other for end users (this last one
> using forrest)..
> 
> So I'd like to unify these two documents and keep it all on Forrest's
> format... then, developers will see the full content while end users
> will receive the same files without some sections...

This sounds like simple pre-processing.

I have a solution tested that works. However
it has a couple of problems. Perhaps other devs
can see a way around it. See the [*] below.

For the sections that you want excluded, add a class
attribute, e.g.
...
  <body>
    <section id="overview">
      <title>Overview</title>
      <p>Hello to all</p>
    </section>
    <section class="dev" id="dev-examples">
      <title>Using examples as templates</title>
      <p>Hello to developers</p>
    </section>
...

In your project sitemap.xmap:
...
<map:match pattern="user-manual**.xml">
  <map:generate src="{project:content.xdocs}{1}.xml"/>
  <map:transform src="{project:resources.stylesheets}/stripDev-to-document.xsl" />
  <map:serialize type="xml-document"/>
</map:match>
...

The stripDev-to-document transformer's stylesheet removes
the relevant sections and xsl:copy the rest. Here is the
main part of the stylesheet:
...
  <xsl:template match="body">
    <body>
      <xsl:apply-templates select="section[not(@class='dev')]"/>
    </body>
  </xsl:template>
...

localhost:8888/index.html gives the full version.
localhost:8888/user-manual/index.html gives the user version.

[*] now to the problems ...

Menus and links all point back to the main site, i.e. to the
"dev" version.

Because of the "user-manual" in the URIs, the left-hand
navigation menus are not triggered open.
 
-David

Mime
View raw message