You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gabor Dolla <ag...@mezon.net> on 2000/04/09 11:50:13 UTC
URI escape
Hi,
I've run into the following problem:
I produce HTML with XML->XSLT->HTML translation with Cocoon, I use 1.7.2.
piece of my xsl file:
<A HREF="a.xml?action=show&what={NAME}">xxx</A>
it works great until the NAME parameter contains spaces.
if NAME contains space the link does not work.
Can I somehow escape it from xsl ?
thanks
Gabor
Re: URI escape
Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 10 Apr 2000, Gabor Dolla wrote:
> >
> > With your last idea I receive the following:
> > Call to extension function failed: method call/new failed:
> > java.lang.NullPointerException
> >
>
> OK, your idea might work ..
>
> > > <xsl:value-of
> > > select="java:java.net.URLEncoder.encode('your-url-to-encode')"/>
>
> my problem is, that I produce HTML so I need the value in a href, like
> this:
> <A TARGET="wmMails" HREF="dummy.xml?action=show&
> what={java:java.net.URLEncoder.encode(NAME)}">
>
> Or is it not possible to use java:java.net.URLEncoder.encode
> between {} ???
>
> Then how can I use the encoded value in a href with
> <xsl:value-of select=".... ???
if nothing else, you can use xsl:attribute to create the HREF attribute
value.
- donald
Re: URI escape
Posted by Gabor Dolla <ag...@mezon.net>.
>
> With your last idea I receive the following:
> Call to extension function failed: method call/new failed:
> java.lang.NullPointerException
>
OK, your idea might work ..
> > <xsl:value-of
> > select="java:java.net.URLEncoder.encode('your-url-to-encode')"/>
my problem is, that I produce HTML so I need the value in a href, like
this:
<A TARGET="wmMails" HREF="dummy.xml?action=show&
what={java:java.net.URLEncoder.encode(NAME)}">
Or is it not possible to use java:java.net.URLEncoder.encode
between {} ???
Then how can I use the encoded value in a href with
<xsl:value-of select=".... ???
thanks
Gabor
Re: URI escape
Posted by Gabor Dolla <ag...@mezon.net>.
Michael,
With your last idea I receive the following:
Call to extension function failed: method call/new failed:
java.lang.NullPointerException
Gabor
On Sun, 9 Apr 2000, Michael Neumann wrote:
> Ok...
> last try ;-)
>
> <xsl:stylesheet
> version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:java="http://xml.apache.org/xslt/java"
> exclude-result-prefixes="java"
> >
>
> <xsl:template match="/">
> <xsl:value-of
> select="java:java.net.URLEncoder.encode('your-url-to-encode')"/>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> -----
> Michael
>
>
>
>
>
> > >
> > > Try the namespace http://xml.apache.org/xslt/java/java.net.URLEncoder
> > > instead of http://www.jclark.com/xt/java/java.net.URLEncoder
> >
> > I tried and received this:
> >
> > Call to extension function failed:
> > http://xml.apache.org/xslt/java/java.net.URLEncoder
> >
> > Gabor
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: URI escape
Posted by Michael Neumann <ne...@s-direktnet.de>.
> > Ok...
> > last try ;-)
>
> thanks for your help, but your last suggestion didn't work, too.
>
>
> Gabor
Are you sure, you are using Xalan as the XSLT-engine?
What error-message comes in the last example?
Michael
Re: URI escape
Posted by Gabor Dolla <ag...@mezon.net>.
> Ok...
> last try ;-)
thanks for your help, but your last suggestion didn't work, too.
Gabor
Re: URI escape
Posted by Michael Neumann <ne...@s-direktnet.de>.
Ok...
last try ;-)
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java"
>
<xsl:template match="/">
<xsl:value-of
select="java:java.net.URLEncoder.encode('your-url-to-encode')"/>
</xsl:template>
</xsl:stylesheet>
-----
Michael
> >
> > Try the namespace http://xml.apache.org/xslt/java/java.net.URLEncoder
> > instead of http://www.jclark.com/xt/java/java.net.URLEncoder
>
> I tried and received this:
>
> Call to extension function failed:
> http://xml.apache.org/xslt/java/java.net.URLEncoder
>
> Gabor
Re: URI escape
Posted by Gabor Dolla <ag...@mezon.net>.
>
> Try the namespace http://xml.apache.org/xslt/java/java.net.URLEncoder
> instead of http://www.jclark.com/xt/java/java.net.URLEncoder
I tried and received this:
Call to extension function failed:
http://xml.apache.org/xslt/java/java.net.URLEncoder
Gabor
Re: URI escape
Posted by Gabor Dolla <ag...@mezon.net>.
> Try the namespace http://xml.apache.org/xslt/java/java.net.URLEncoder
> instead of http://www.jclark.com/xt/java/java.net.URLEncoder
>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head><title>xxx</title>
<meta content="text/html; charset=iso-8859-2" http-equiv="Content-type">
</head>
<body onload="javascript: var isValid=true;"
xmlns:urlencode="http://xml.apache.org/xslt/java/java.net.URLEncoder">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I see this in the html source an quoted above ...
Gabor
Re: URI escape
Posted by Michael Neumann <ne...@s-direktnet.de>.
Hello,
Try the namespace http://xml.apache.org/xslt/java/java.net.URLEncoder
instead of http://www.jclark.com/xt/java/java.net.URLEncoder
Michael
> Michael,
>
> Thanks for your help. Now I receive:
> Call to extension function failed:
> http://www.jclark.com/xt/java/java.net.URLEncoder
>
> Should I include any new jar file into my CLASSPATH ?
>
> thanks
>
> Gabor
Re: URI escape
Posted by Gabor Dolla <ag...@mezon.net>.
Michael,
Thanks for your help. Now I receive:
Call to extension function failed:
http://www.jclark.com/xt/java/java.net.URLEncoder
Should I include any new jar file into my CLASSPATH ?
thanks
Gabor
Re: URI escape
Posted by Michael Neumann <ne...@s-direktnet.de>.
Hello...
I am new in Cocoon, but I have worked with other XSLT-Engines like XT, Saxon
and LotusXSL.
In XT and Saxon, you can use Java-classes easiliy from within XSL:
You have to declare the name of the Java-class (here java.net.URLEncoder) in
the namespace:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:urlencode="http://www.jclark.com/xt/java/java.net.URLEncoder"
>
<xsl:template match="/">
<xsl:value-of select="urlencode:encode('your-url-to-encode')"/>
</xsl:template>
</xsl:stylesheet>
The static function "encode" of class "URLEncoder" encodes the argument and
returns the encoded string.
Michael
> Hi,
>
> I've run into the following problem:
> I produce HTML with XML->XSLT->HTML translation with Cocoon, I use 1.7.2.
>
> piece of my xsl file:
> <A HREF="a.xml?action=show&what={NAME}">xxx</A>
> it works great until the NAME parameter contains spaces.
> if NAME contains space the link does not work.
> Can I somehow escape it from xsl ?
>
> thanks
>
> Gabor