forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Re: [RT] InputModuleTransformer for linking (Re: [RT] LinkTranslator Usage)
Date Sun, 15 Dec 2002 11:07:28 GMT
On Sun, Dec 15, 2002 at 10:08:49AM +0100, Bernhard Huber wrote:
> hi,
> 
> >
> > With link translation, we need exactly the same thing!  Given a semantic
> > link, we need to look up a 'real' link.  In particular, to implement a
> > linkmap, we need exactly XMLFileModule's functionality.  A link like
> > <link href="site:/primer">, the address 'site:/primer' can be resolved by
> > looking up a 'site' input module (mapped to an XMLFileModule), which
> > would then use '/primer' as an XPath expression to look up the node.
> >
> okay, you have a "<link href="site:/primer"> in you xml-document.
> The LinkTranslator/LinkRewriterTransformer can rewrite/map site:/primer 
> to some new href.
> 
> okay, the details of rewrite/map are either implemented by
> LinkTranslator or LinkRewriterTransformer.
> 
> As LinkTranslator is implemented now Cocoon2.1 as far as i understand
> can only rewrite the link. Thus the above "<link href="site:/primer>"
> may rewritten to "<link href="primer.html">.

Yes, that's the basic idea.  Btw, a 'linkmap' is an XML mapping from 'semantic'
URIs ike 'page:/index' to physical sources (index.xml) and final destination
(index.wml or index.html):

http://marc.theaimsgroup.com/?t=103444042500002&r=1&w=2

> > So anyway, I'm thinking, how about implementing this as a generic
> > InputModuleTransformer, which is configured with a) an InputModule, b) an
> > XPath expression of nodes to transform.  So to transform hrefs in links,
> > we'd have:
> >
> > <map:transformers>
> >   <map:transformer name="inputmodule" 
> src="o.a.c.t.InputModuleTransformer">
> >     <input-module>linkmap</input-module>
> >     ...
> >     <transformed-nodes>//link/@href</transformed-nodes>
> >   </map:transformer>
> > </map:transformers>
> >
> > Where 'linkmap' is defined in cocoon.xconf as:
> >
> > <component-instance name="linkmap" 
> class="o.a.c.c.modules.input.XMLFileModule"
> >     <file src="context://linkmap.xml"/>
> > </component-instance>
> >
> > Since XMLFileModule can use any Source, so can our linking system.  Want
> > to link to whatever's the top Slashdot article?  Add a 'slashdot'
> > InputModule (in the samples sitemap), and add <link
> > href="slashdot:/*:RDF/item[1]/title}">Slashdot Headline</link> to your
> > XML.
> >
> > What do people think?  Is this the base for a majorly cool linking
> > system, or am I missing something?
> >
> I must admit that i have followed a bit the module-discussion,
> but don't know how-to use it in the sitemap.

Just {module:key} variables.  See src/webapp/samples/modules/sitemap.xmap.

> The LinkRewriterTransformer seems to be a bit more flexible.
> What is the rewritten <link href="slashdot:/*:RDF/item[1]/title">?
> Does linkmap.xml contains the mapping?

No, the transformer would lookup up InputModule called 'slashdot', which
is defined as follows in cocoon.xconf:

<component-instance name="slashdot" class="o.a.c.c.modules.input.XMLFileModule">  
  <file src="http://slashdot.org/slashdot.rss"/>
</component-instance>

So '/*:RDF/item[1]/title' is an XPath address for a node in slashdot.rss.
Actually that returns the title; we'd want /*:RDF/item[1]/link, which currently
is returning:

<link>http://slashdot.org/article.pl?sid=02/12/15/0247238</link>

> The cool feature of a linking system:
> Slashdot changes its internal linking, only updating the linkmap.xml
> will adopt my site to the new slashdot structure w/o changing the xml 
> documents
> of my site.
> As far as i see LinkTranslator/LinkTransformer support this.

Yep :)  Manage a whole site's linking from a few metadata files and a linkmap.

I am currently re-jigging my XPathTransformer to create all this.

--Jeff

> bye bernhard
> 

Mime
View raw message