2012/5/16 Bob Harrod <[email protected]>

> Ok, thank you!  I can look at the LinkRewriterTransformer.  Since I'm new
> to this, I have some follow up questions:
>
> 1. Is this a "plugin" that I have to install or does it exist in the stock
> version of cocoon 2.1?
>

It's included as a block for cocoon-2.1 and it's builded with cocoon-2.1 by
default but I've used it for Cocoon 2.2 & 3 so I'm not sure how to
configure it. I remember that you have to declare the component at the
beginning of the sitemap before use it. You can browse the block code and
samples for linkrewritter here

http://svn.apache.org/viewvc/cocoon/tags/cocoon-2.1/RELEASE_2_1_11/src/blocks/linkrewriter/

Or even better, download the sources and play a bit with the samples :)

http://svn.apache.org/repos/asf/cocoon/tags/cocoon-2.1/RELEASE_2_1_11


> 2. The examples reference the transformer from a sitemap context.  Is
> there a way to use the LinkRewriterTranformer directly from another
> transform (as this transform is actually creating the anchor)?
>

The LinkRewriterTransformer is a transformer component for pipeline process
and must be used from a sitemap context. You should place the transformer
in the pipeline so the links get transformed to the right location, usually
at the end of the pipeline before the serializer.

<map:pipeline>
...

  <map:match pattern="welcome">
    <map:generate src="welcome.xml">
    <map:transform src="xslt/xml2page.xsl"/> <!-- your transformation -->
    <map:transform type="linkrewritter" src="cocoon:/linkmap"> <!-- the
links are transformed -->
      <map:parameter name="namespace-uri" value="
http://www.w3.org/1999/xhtml"/>
    </map:transform>
    <map:serialize type="xml"/>
  </map:match>

...
</map:pipeline>



>
> Thanks so much for your help.
>
> - Bob
>
>
> On Wed, May 16, 2012 at 10:24 AM, Bob Harrod <[email protected]> wrote:
>
>> I'm rending html in a transform, and would like to render an anchor who's
>> href is absolute, not relative.  For example, instead of this:
>>
>> <a href="../home">...</a>
>>
>> I would like to be able to provide a full url in the href:
>>
>> <a href="http://mysite/application1/home";>...</a>
>>
>> Thank you for your assistance with this!
>>
>>
>> On Wed, May 16, 2012 at 12:52 AM, Bob Harrod <[email protected]> wrote:
>>
>>> I'm quite new to cocoon, and supporting an older version (2.1).  Does
>>> anyone know how I can gain access the web application base path inside of a
>>> transform?  Of course, it can be passed by the sitemap...  Any help would
>>> be appreciated!
>>>
>>> Thanks!
>>>
>>
>>
>

Reply via email to