forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: common+skins document2html.xsl questions
Date Mon, 23 Jan 2006 00:13:17 GMT
Helena Edelson wrote:
> >Helena escribi?3:
> >
> >>I am confused on getting data into xdocs content.
> >>
> >does it has to be *in* the xdocs? Or is it that is coming just
> >afterward? Is it xdocs itself, if so did you try a "simple" cinclude on
> >the xdocs (before skining)?
> 
> Do you mean implement a c_include on the xdocs (before skining)? in the 
> skin?
> Would need to set up some control since the content I'm trying to get 
> into a document is different or not needed for each.

Yes the include mechanisms would operate before skinning,
at the content gathering stage.

Another way would be to create a project sitemap to add the content
(before skinning). The sitemap can deal with adding different content
for different URL patterns.

There was a example about this recently on the mailing lists.
The user was over-riding the core *.html pipeline for certain
docs. The relevant aggregation happens around line 508 of
$FORREST_HOME/main/webapp/sitemap.xmap in forrest_07_branch
and the subsequent match. You would need to copy this to your
project sitemap and add an extra map:part for your new content
nugget. See the recent mailing list example.

Perhaps you have some pages that need specialised content.
Another way is to add a specific match to generate the
content via your project sitemap. Here is something from
a new howto i have been developing about scraping html
from other webpages. This just operates on one specific page
but it could match a set of pages.

  <map:match pattern="asx-announce.xml">
    <map:aggregate element="watchlist-and-tables">
      <map:part src="{project:resources}/watchlist-asx.xml"/>
      <map:part src="cocoon:/get-asx-announce-today"/> 
     </map:aggregate>
[1] <map:transform src="{project:resources.stylesheets}/asx-announce-to-internal.xsl" />
    <map:serialize type="xml-document"/>
  </map:match>
  <map:match pattern="get-asx-announce-today">
    <map:generate type="html" src="http://asx.com.au/asx/statistics/todayAnnHeaders.jsp"
/>
    <map:transform src="{project:resources.stylesheets}/asx-announce-today-to-table.xsl"
/>
    <map:serialize type="xml"/>
  </map:match>

The stylesheet at [1] produces Forrest internal xdoc format.

[ snip ]
> Well, not in this instance. I was thinking about a php app, or some java 
> things where there is a string config file for instance,
> allowing you to get fields into the content area (xdocs), but there is 
> code controling what goes where when, which xdocs content won't.
> 
> >>The only way I see is to customize both common document2html.xsl and 
> >>skins document2html.xsl
> >>(very messy:reusability rather sad)
> >
> >Yes, that is why I started the work on the dispatcher aka views. Here
> >you can easily define custom business services that you can include and
> >process in your output.

There are ways to get extra content into the xml stream
before the skinning stage, using Cocoon sitemap aggregation.
See above.

As you can see, it will be a lot easier with the new Dispatcher.

                        --oOo--

> >>class="fork" is being stripped by my editor and <link> not allowed.
> >>
> >link is xdocs < 2.0 and in =>2.0  it is <a/>.
> >http://forrest.apache.org/dtdx/document-v20.html#changes-20
>
> I tried both link and a to be sure, neither worked for me, must be an 
> editor issue.
> 
> >Seems you need to configure your editor that @class does not get
> >stripped. Try with "vi", that will not strip it. ;-)
> >
> >>tested a custom template for matching <a> to implement class fork but it

> >>kept being stripped.
> >>did a bunch of (starts-with...) to catch "http:" and if found, do <a 
> >>href="{@href} target="_blank"> just like "fork"
> >>with no luck either on like ten tries at template variations. Anyone 
> >>have any ideas?

I don't understand why you keep asking about this
class=fork thing. There is a demonstartion of the
ability in a 'forrest seed-sample' site:
samples/sample.html#link-class
and in the reference documentation
http://forrest.apache.org/dtdx/document-v20.html#link-class

Are you sure that you are using document-v20?

> >Hmm, I have just tested it on the lenya docu and it is working like a
> >charm.
> ><p> The server <a href="ext:lenya-zone"
> >class="fork">lenya.zones.apache.org</a> provides our testing and
> >demonstration area. It is managed by Apache Lenya committers. </p>
> >
> I get  error:ext:lenya-zone for the resulting URL. 

This sounds like a basic forrest user error.
Define "lenya-zone" in your site.xml

> <a href="ext:lenya-zone"
> class="fork">lenya.zones.apache.org</a> 
> 
> ?

But that is what you want - the class=fork is there.

> Is it worth waiting on this and helping to test the Dispatcher? 
> I've been trying everything off an on for a while now.
> no luck yet.

Everything that you want to do can be done with the
existing Forrest.

-David

Mime
View raw message