Conal Tuohy wrote:

I have searched without success for documentation about the JXTemplateTransformer. Is there any?


http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html

I want to transform an XHTML document, and for each hyperlink in the XHTML, I want to use JXPath to look it up in a Java model, and add some resulting data as a "title" attribute for the link. e.g.


You have to use the flowscript to inject data in your page, for example.

In pipeline

<map:match pattern="path/*.do">
 <map:call function="do_{1}"/>
</map>

in the flwo script

function do_someFunction() {
var link = cocoon.request.link;
cocoon.sendPage("otherpath/yourpage.xml", { "link" , link}); // In Your pipeline you have to match otherpath/yourpage.html
}


<map: match pattern="otherpath/{1}.html">
  <map:generate src="pathofyourpage/{1}.xml" type="jx"/>
   <map:transform src=".."/>
   <map:serialize/>
</map>

in your page

<jx:choose>
 <jx:when test="${link == 'foo.html'}>
    <a href="foo.html" title="Foo Bar Baz">Foo</a>
 </jx:when>
 <jx:when test="${link == 'gino.html'}>
    <a href="gino.html" title="Gino page">Gino</a>
 </jx:when>
   .
   .
  <jx:otherwise>
    some default action
  </jx:otherwise>
<jx:/choose>

then when you call path path/someFunction.do?link=foo.html the jxtemplate generator execute the choose block and send out
<a href="foo.html" title="Foo Bar Baz">Foo</a>


I hope this can help you

Bye Gioni

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to