cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: (Woody) How to produce a hyperlink based on bound values from an XML document (2)
Date Fri, 26 Sep 2003 12:46:24 GMT
On Thu, 2003-09-25 at 22:10, jcplerm wrote:
> One more detail: I know I can simply paste read-only values onto an
> HTML form with "output" fields.
> I would write the category code from the example below enclosed in XML
> tags which could be further transformed into the final "<a href...>"
> tag. 
>  
> But for the hyperlink I need the {request:contextPath} prepended to
> the partial URI to form the complete target URL.
>  
> In form templates, I know that I can access request/session/...
> variables within the "action" and "location" attributes of the
> <wt:form-template> tag.
>  
> But I need to have similar access to those vars elsewhere on the same
> form template to compose the target URLs I am looking for.

You can do this by changing the file generator which reads the template
file into a "jx" generator. Then you can use ${...} or #{...}
everywhere. More information about the JXTemplate generator can be found
here:
http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html

>  
> Any ideas?
>  
> Thanks,
>  
> jlerm
>         ----- Original Message ----- 
>         From: jcplerm
>         To: users@cocoon.apache.org
>         Sent: Thursday, September 25, 2003 2:53 PM
>         Subject: (Woody) How to produce a hyperlink based on bound
>         values from an XML document
>         
>         I would like to add, along with regular Woody fields populated
>         by XML binding, hyperlinks to other URLs based on values from
>         that same XML document.
>          
>         For instance, in order to edit the properties of a product I
>         have input fields for SKU#, dimensions, price, etc.
>         But I would also like to provide a link to jump to the page to
>         edit the category this product belongs to.
>         The category code, in my application, is a read-only value on
>         the product editing page, which should be presented as a link
>         with a "<a href=.../>" tag.
>          
>         How can this be done?

In different ways. For one, to stay in the same sphere as above, pass on
your XML document to the view layer by passing it in the bizdata
argument of the showForm method (assuming you're using flowscript --
though it's not different for apples).

in the flowscript you would do something like this:

bizdata = {"myxml": myxmldoc};
form.showForm("the-pipeline", bizdata);

and in the template XML file somewhere:

<a href="http://blabla/#{myxml/some/elements/deep/sku}"/>

(warning: the above is only pseudo-code)

Alternatively, you could also load the value into an output widget, and
then either use a specific stylesheet template to render it into the
correct link, or again use the jxtemplate generator to extract the value
using a jexl or jxpath expression (the woody form is available as a
variable called "woody-form").

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message