You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Werner Guttmann <We...@msdw.com> on 2000/07/11 11:51:36 UTC

Using ...

Hi,

since an earlier email of myself got a bit ignored, I am assuming that
this is because of my inability to get the description of the problem I
am currently facing right ... ;-).

Well, in the past I have successfully used the XSP SQL taglib and an XSL
stylesheet to run

a) a query against an internal database
b) generate html (incl. a table) from the result set (sometimes using
the value of a field to create a <a href="..."> element based on the
content of the field)

So far, so fine. Nothing which is new and nothing which would be really
difficult.

Last week, I tried to apply the same 'approach' to another set of tables
to produce a first prototype for some application. The problem this
time: the primary key of one of the tables is a string field which is
allowed to include blanks.

I guess in order to generate an <a href=".."> element again, I will have
to encode the url passed to the href attribute. And that's exactly where
I am stuck ... :-(. The response taglib apparently specifies an
<response:url-encode> element (with the matching template rule in the
logicsheet), but where I the above chain would I have to use it.

Any help would be appreciated.

Regards
Werner Guttmann



Re: Using ...

Posted by Uli Mayring <ul...@denic.de>.
On Tue, 11 Jul 2000, Donald Ball wrote:

> On Tue, 11 Jul 2000, Uli Mayring wrote:
> 
> > *Lightbulb* - could that be a way to do Java without getting your XML
> > compiled (as with XSP)?
> 
> uh, sure, yeah, xalan extension functions let you do that and then
> some. personally, i like doing my content generation logic in XSP, while I
> use xalan extension functions for massaging the results a little (maybe
> some date formatting, maybe some string manip, maybe some
> urlencoding).

You are absolutely right, of course, but this is currently the only way to
avoid the 64K barrier for the populateDocument method with XSP. Another
way may be Jeremy's fp taglib, which could again work in an XSP context.

> but there are those who like to do content generation in
> their stylesheets. i'm curious to see how that's going to pan out in the
> long run. might be a good fit for you.

Stylesheets should not generate content, they should just style it. On the
other hand the difference may be academic:

XSP way:

<dynamiccontent><xsp:expr>doLogic()</xsp:expr></dynamiccontent>

XSLT way:

<xsl:template match="dynamiccontent">
     <xsl:value-of select="myclass:doLogic()"/>
</xsl:template>

The important thing is what happens in doLogic() and that is external to
the content in both cases. We do not lose seperation of content and logic
in this way.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Softwareentwicklung


Re: Using ...

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 11 Jul 2000, Uli Mayring wrote:

> On Tue, 11 Jul 2000, sudhi wrote:
> 
> > <xsl:value-of select="java:java.net.URLEncoder.encode($url)"/>
> 
> *Lightbulb* - could that be a way to do Java without getting your XML
> compiled (as with XSP)?

uh, sure, yeah, xalan extension functions let you do that and then
some. personally, i like doing my content generation logic in XSP, while I
use xalan extension functions for massaging the results a little (maybe
some date formatting, maybe some string manip, maybe some
urlencoding). but there are those who like to do content generation in
their stylesheets. i'm curious to see how that's going to pan out in the
long run. might be a good fit for you.

- donald


Re: Using ...

Posted by Uli Mayring <ul...@denic.de>.
On Tue, 11 Jul 2000, sudhi wrote:

> <xsl:value-of select="java:java.net.URLEncoder.encode($url)"/>

*Lightbulb* - could that be a way to do Java without getting your XML
compiled (as with XSP)?

Ulrich

-- 
Ulrich Mayring
DENIC eG, Softwareentwicklung


Re: Using ...

Posted by sudhi <su...@insage.com>.
Hi,
U can encode url in so many ways. 
By calling encodeUrl method in response object in your xsp page.
A few days back I saw a post may be this is what u need. I am pasting it
here...
----------------------------------------
On Sun, 25 Jun 2000, Zvi wrote:

> Donald,
> 
> but how I can access request object from Xalan extension? I tried to
> modify Cocoon source and pass it as XSLT parameter, but this doesn't
> worked.


why do you need to mess with a request object? as i understand it,
you're
generating a bunch of data from an sql query, then you want to generate
links with request parameters that contain special characters that need
to
be encoded. yes? so call java.net.URLEncoder.encode from your XSLT
stylesheet like this:

<xsl:value-of select="java:java.net.URLEncoder.encode($url)"/>

see http://xml.apache.org/xalan/extensions.html#java-namespace

for more information on this shortcut.

If you need to access request parameters in your XSLT page, simply
declare
them:

<xsl:param name="foo"/>

and reference them using $foo. am i missing something?

- donald
----------------------------------------


> I guess in order to generate an <a href=".."> element again, I will have
> to encode the url passed to the href attribute. And that's exactly where
> I am stuck ... :-(. The response taglib apparently specifies an
> <response:url-encode> element (with the matching template rule in the
> logicsheet), but where I the above chain would I have to use it.
> 


HTH
Sudhi

Re: Using ...

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 11 Jul 2000, Werner Guttmann wrote:

> Last week, I tried to apply the same 'approach' to another set of tables
> to produce a first prototype for some application. The problem this
> time: the primary key of one of the tables is a string field which is
> allowed to include blanks.
> 
> I guess in order to generate an <a href=".."> element again, I will have
> to encode the url passed to the href attribute. And that's exactly where
> I am stuck ... :-(. The response taglib apparently specifies an
> <response:url-encode> element (with the matching template rule in the
> logicsheet), but where I the above chain would I have to use it.
> 
> Any help would be appreciated.

I would do it in the stylesheet using a Xalan Java extension call. 

- donald