fn:resolve-uri() question

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

fn:resolve-uri() question

Rademacher, Gunther
While using fn:resolve-uri for resolving HTML links, I found
that
 
   resolve-uri("?y", "http://test.com/a/b?x")
   
results in
 
   http://test.com/a/?y
   
i.e. the final path segment is lost, when the relative URI
consists of just the query component. The expected result for
an HTML link however is
 
   http://test.com/a/b?y
 
which is what the browsers do.
 
The XQuery CR refers to RFC2396 and RFC3986, and at least the
algorithm of the latter in my understanding keeps the full
path component. Should not resolve-uri keep it as well?



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

Re: fn:resolve-uri() question

Colin Paul Adams
>>>>> "Gunther" == Rademacher, Gunther <[hidden email]> writes:

    Gunther> While using fn:resolve-uri for resolving HTML links, I
    Gunther> found that
 
    Gunther>    resolve-uri("?y", "http://test.com/a/b?x")
   
    Gunther> results in
 
    Gunther>    http://test.com/a/?y
   
    Gunther> i.e. the final path segment is lost, when the relative
    Gunther> URI consists of just the query component. The expected
    Gunther> result for an HTML link however is
 
    Gunther>    http://test.com/a/b?y
 
    Gunther> which is what the browsers do.
 
    Gunther> The XQuery CR refers to RFC2396 and RFC3986, and at least
    Gunther> the algorithm of the latter in my understanding keeps the
    Gunther> full path component. Should not resolve-uri keep it as
    Gunther> well?

Mike, I think he is right.

I just tested it with gestalt, and I get:

http://test.com/a/b?y

Now the Eiffel class that gestalt is using for URI resolution was
carefully designed and tested over many months to ensure compliance
with RFC3986. Coupled with the evidence of the browsers, I think
Saxon is getting this wrong.
--
Colin Adams
Preston Lancashire


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: fn:resolve-uri() question

Michael Kay
> Now the Eiffel class that gestalt is using for URI resolution was
> carefully designed and tested over many months to ensure compliance
> with RFC3986. Coupled with the evidence of the browsers, I think
> Saxon is getting this wrong.


Saxon is relying on the java.net.URI class to do URI resolution. I'll look
into it when I get a chance, and if it's wrong, I'll raise a bug on the JDK.
I'm not going to try and implement the algorithm myself - if the JDK can't
get it right, then there's little chance I will succeed. The RFCs are
notoriously fuzzy at the edges.

Michael Kay
http://www.saxonica.com/




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: fn:resolve-uri() question

Owen Rees
--On Wednesday, November 09, 2005 10:17:05 +0000 Michael Kay wrote:

> Saxon is relying on the java.net.URI class to do URI resolution. I'll look
> into it when I get a chance, and if it's wrong, I'll raise a bug on the
> JDK. I'm not going to try and implement the algorithm myself - if the JDK
> can't get it right, then there's little chance I will succeed. The RFCs
> are notoriously fuzzy at the edges.

RFC3986 restored the behaviour of RFC1808 in this case, RFC2396 specified
different behaviour. All three contain an example that covers this case and
this shows the specification change quite clearly.

It seems that java.net.URI class resolve method (in Java 5 at least)
implements the RFC2396 specification in this case.

--
Owen Rees
Hewlett Packard Laboratories, Bristol, UK



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: fn:resolve-uri() question

Michael Kay
In reply to this post by Rademacher, Gunther
To confirm and add to what has already been said on this thread:

(a) Saxon is doing what the JDK 5.0 java.net.URI class does

(b) java.net.URI is doing what RFC 2396 says

(c) this is conformant with the W3C spec for resolve-uri(): see
 http://www.w3.org/TR/xpath-functions/#func-resolve-uri

(d) RFC 3986 changes the behavior from RFC 2396

(e) The W3C spec also permits use of the RFC 3986 algorithm

(f) It appears that JDK 6 will replace the RFC 2396 algorithm with the RFC
3986 algorithm. So all that you need to do to get the desired behaviour is
to upgrade to JDK 6 when it becomes available.

In the light of this, I propose to do nothing. If it's really important to
you to use the RFC 3986 algorithm now, you can always implement an extension
function to do it.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Rademacher, Gunther
> Sent: 08 November 2005 23:22
> To: [hidden email]
> Subject: [saxon] fn:resolve-uri() question
>
> While using fn:resolve-uri for resolving HTML links, I found
> that
>  
>    resolve-uri("?y", "http://test.com/a/b?x")
>    
> results in
>  
>    http://test.com/a/?y
>    
> i.e. the final path segment is lost, when the relative URI
> consists of just the query component. The expected result for
> an HTML link however is
>  
>    http://test.com/a/b?y
>  
> which is what the browsers do.
>  
> The XQuery CR refers to RFC2396 and RFC3986, and at least the
> algorithm of the latter in my understanding keeps the full
> path component. Should not resolve-uri keep it as well?
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App
> Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: fn:resolve-uri() question

Rademacher, Gunther
In reply to this post by Rademacher, Gunther
> In the light of this, I propose to do nothing. If it's really
> important to you to use the RFC 3986 algorithm now, you can
> always implement an extension function to do it.

I have no objection, in fact I have solved my problem by wrapping
fn:resolve-uri into an XQuery function correcting the symptom.

Thanks for looking into this problem.


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help