You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Steven Noels <st...@outerthought.org> on 2002/08/28 10:00:29 UTC

mental note

Something we still should think about (still catching up on mail):

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

</Steven>
-- 
Steven Noels                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
stevenn@outerthought.org                      stevenn@apache.org


Re: mental note (WAS Common practice: how to keep links to html-trees consistent)

Posted by Ovidiu Predescu <ov...@apache.org>.
On Wednesday, August 28, 2002, at 01:00 AM, Steven Noels wrote:

> Something we still should think about (still catching up on mail):
>
> http://marc.theaimsgroup.com/?t=102978950000005&r=1&w=2
>
> </Steven>

Thanks for pointing this out. To solve the problem I came up some time 
ago with a simple transformer which augments the href attribute of any 
element with the full path. The full path can be specified in the 
sitemap like below:

   <map:components>
     <map:transformers default="xslt">
      <map:transformer name="augment"
                       
src="org.apache.cocoon.transformation.AugmentTransformer"
                       mime-type="text/xml"
                       logger="sitemap.transformer.augment"/>
     </map:transformers>
   </map:components>

       <map:match pattern="doc/*.html">
         <map:generate src="docs/{1}.xml"/>
         <map:transform type="augment">
           <map:parameter name="mount" value="samples/flow/"/>
         </map:transform>
         <map:transform 
src="context://documentation/stylesheets/document2html.xsl"/>
         <map:serialize type="xml"/>
       </map:match>

In this example for any request for a document from the docs/ 
directory, the source XML document is first processed through the 
"augment" transformer, defined in the map:components as above. This 
replaces all the href attributes of any element with the concatenated 
value of the "mount" attribute followed by the original value of the 
attribute. E.g. in our sample if we had an element in the original XML 
doc like

<link href="index.html"/>

This becomes

<link href="samples/flow/index.html"/>

after the processing.

Regards,
-- 
Ovidiu Predescu <ov...@apache.org>
http://webweavertech.com/ovidiu/weblog/ (Weblog)
http://www.geocities.com/SiliconValley/Monitor/7464/ (Apache, GNU, 
Emacs ...)


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>