cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Guttmann <Werner.Guttm...@msdw.com>
Subject Re: Use of <xsp:attribute> when calling a logicsheet
Date Wed, 10 Jan 2001 18:41:18 GMT
Robin,

see below ...

Regards
Werner

Robin Green wrote:

> Werner Guttmann <Werner.Guttmann@msdw.com> wrote:
> >I am about to implement my own tag library for an inhouse systems which
> >we'd like to control from within Cocoon. I've got the tag library
> >working as in that it successfully does what it is supposed to be doing,
> >e.g. start and stopping RMI subsystems.
> >
> >There's one odd thing, though, when I try to use this tag library.
> >Issueing
> >
> ><spider:manageSubsystem service="MQ" action="stop" />
> >
> >i.e. hardcoding servicename and the action to executed, everything works
> >fine and the specified RMI subsystem is successfully stopped. When I try
> >to create one or both of these attributes using <xsp:attribute>, things
> >do not work.
> >
> >Issuing
> >
> ><spider:manageSubsystem>
> >   <xsp:attribute name="service">MQ</xsp:attribute>
> >   <xsp:attribute name="action">stop</xsp:attribute>
> ></spider:manageSubsystem>
> >
> >never passes the attributes to the logicsheet. Any idea why, or what I
> >am doing wrong here ?
>
> XSP produces Producers which are then executed. The Producers contain your
> actual Java code. <xsp:attribute> is replaced with some Java code which
> applies to the output document of the Producer. You are trying to modify the
> generation of the Producer, while the Producer is running - but at that
> stage, the Producer has already been generated so you can't!
>
> Instead you need to either
>
> (1) not use xsp:attribute but make your logicsheet treat the attribute value
> as a Java expression. This should work fine.
>
> or (2) use elements instead of attributes and use the get-nested-content
> template from ESQL - this is the best solution because you can nest
> arbitrary levels of taglibs as long as they all use get-nested-content and
> don't interfere with each other.
>

Followed your advise and switched to using elements for specifying the service
to be affected and the action to be taken. The following xml fragment

<manage:manageSubsystem>
    <manage:service>MQ</manage:service>
    <manage:action>stop</manage:action>
</manage:manageSubsystem>

works as planned. If I try to use the request taglib to substitute "MQ" and
"stop" with values passed in via the HTTP request

<manage:manageSubsystem>
    <manage:service>
        <request:get-parameter name="service" default="MQ" />
    </manage:service>
    <manage:action>
        <request:get-parameter name="action" default="stop" />
    </manage:action>
</manage:manageSubsystem>

I still do not get the results as expected.

Here's the relevant code from my logicsheet:

  <xsl:template match="manage:manageSubsystem">
    <xsl:variable name="service">
      <xsl:call-template name="get-nested-content">
        <xsl:with-param name="content" select="manage:service"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="action">
      <xsl:call-template name="get-nested-content">
        <xsl:with-param name="content" select="manage:action"/>
      </xsl:call-template>
    </xsl:variable>
    <paragraph>
      About to <xsl:value-of select="$action"/> service <xsl:value-of
select="$service"/>.
    </paragraph>
  </xsl:template>

Output still is

About to service .

, i.e. $service and $action are blank.

Regards
Werner


>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


Mime
View raw message