cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saravanan Bellan <>
Subject RE: variables in util:include-uri
Date Sat, 19 Aug 2000 04:48:08 GMT
Thanks so much. It really helps.

-----Original Message-----
From: Ricardo Rocha []
Sent: Friday, August 18, 2000 8:37 PM
Subject: Re: variables in util:include-uri

Saravanan Bellan wrote:
> How can I use a variable in the href attribute of util:inlcude-uri?

Parameter values are passed to dynamic tags by means of
constant attributes or nested elements.

For example, the utility tag <util:include-uri> is used to
include XML content from any arbitrary URI:

  <p>The following is included XML content:</p>
  <util:include href="http://localhost/something.xml"/>

In this case, the URI is known at design time an is expressed
as an attribute in tag <util:include>.

When the URI is known only at request time, the URI
parameter is passed as a nested <util:href> element.

  <p>The following is included XML content:</p>
    <util:href><request:get-parameter name="whereTo"/></util:href>

will include the contents of the URL pointed to by the
value of the HTTP request parameter "whereTo". This allows
for requests such as:


Note that the following also works fine:


that is: the nested element form can also be used for
constant values if preferred.

Note: constant values used inside <util:href> are treated
by XSP as XML text() nodes. They're _not_ [Java] expressions.

Passing parameters to taglib dynamic tags as either attributes
or nested elements is an XML pattern used consistently in all
Cocoon-supplied taglibs, not only in the "util.xsl" taglib.

The criteria used is rather simplistic but uniform:

- For constant values use attributes if it makes the
  XML document more readable:

  <p>It's now <util:time format="hh:mm:ss"/></p>

- For variable values, always use nested elements with the same
  tag name as the attribute name and within the same namespace as
  the dynamic tag:

    String defaultFormat = "hh:mm:ss aa";
  .  .  .
  <p>It's now

The following also works:

  <p>It's now
        <request:get-parameter name="format" default="hh:mm:ss">

where system time would be formatted:

- as specified by the value of the HTTP request parameter "format",
- as "hh:mm:ss" when such parameter is not specified in the request.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message