[Yanel-dev] Contract of BasicXMLResource subclasses, when using controller-adapter

Rob Adamson bobacus at gmail.com
Wed Oct 20 15:10:29 CEST 2010


Hi Cedric,

On 20 October 2010 12:32, Cedric Staub <cedric.staub at wyona.com> wrote:
> Hello Rob
>
> On Wed, Oct 20, 2010 at 10:29:56AM +0100, Rob Adamson wrote:
>> How can I bind values to attributes accessible from the 'done'
>> template? (a Jelly template.)
>
> I'm not sure I fully understand what you're saying here. Yanel should
> pass the requested viewId to the resource. A resource can tell Yanel
> which viewIds exist by implementing getViewDescriptors, and some
> resources allow you to specify views in their resource config.
>
> If that's what controller-adapter is doing (reading the views from the
> resource configuration) and 'done' is the requested viewId, then this
> corresponds to the viewId passed to getContentXML.
>
> Is that what you meant?

Well, I'm not sure where the viewId comes from, presumably the
controller adapter resource itself.

All I need to know is how to use Jelly, or perhaps XSLT, to handle the
'done' view.

Here's the resource configuration:

<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
  <yanel:rti name="controller-adapter"
namespace="http://www.wyona.org/yanel/resource/1.0"/>
  <yanel:custom-config>
    <views xmlns="http://www.wyona.org/yanel/rti/1.0">
      <view id="default">
        <template
type="JELLY">yanelrepo:/app/jelly/create-event-DEFAULT.jelly</template>
      </view>

      <view id="done">
        <template
type="JELLY">yanelrepo:/app/jelly/create-event-DONE.jelly</template>
        <serializer key="XHTML_STRICT"/>
      </view>

      <view id="cancel">
        <template
type="JELLY">yanelrepo:/app/jelly/create-event-CANCEL.jelly</template>
        <serializer key="XHTML_STRICT"/>
      </view>
    </views>

  </yanel:custom-config>
</yanel:resource-config>

and here's the resource configuration for the *adapted* resource:

<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
  <yanel:rti name="event"
namespace="http://www.tate.org.uk/yanel/resource/1.0"/>

  <yanel:property name="xslt" value="/app/xslt/event_template.xsl"/>
  <yanel:property name="mime-type" value="text/html"/>

</yanel:resource-config>

and finally here's the current template create-event-DONE.jelly:

<j:jelly
  xmlns:j="jelly:core"
  xmlns:yj="jelly:org.wyona.yanel.impl.jelly.tags.SimpleJellyTagLibrary"
  xmlns="http://www.w3.org/1999/xhtml">
  <html>
    <head>
      <title>Event asset/page has been created</title>
    </head>
    <body>
      <div>An event asset/page was created at:</div>
      <div>
      <a href="${yanel.back2realm}en/events/${year}/${id}.html">en/events/${year}/${id}.html</a>
      </div>
    </body>
  </html>
</j:jelly>

My question is, how to I get data into this template, from the adapted
resource's getContentXML.

Should I output the data in the XML stream?

Should I call some magic method?

How should I refer to the data in the template?

Thanks,
Rob


More information about the Yanel-development mailing list