Function: rng-relative-uri

rng-relative-uri is a byte-compiled function defined in rng-uri.el.gz.

Signature

(rng-relative-uri FULL BASE)

Documentation

Return a URI that relative to BASE is equivalent to FULL.

The returned URI will be relative if possible. Both FULL and BASE must be absolute URIs.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/rng-uri.el.gz
(defun rng-relative-uri (full base)
  "Return a URI that relative to BASE is equivalent to FULL.
The returned URI will be relative if possible.
Both FULL and BASE must be absolute URIs."
  (let* ((components (rng-uri-split full))
	 (scheme (nth 0 components))
	 (authority (nth 1 components))
	 (path (nth 2 components))
	 (query (nth 3 components))
	 (fragment-id (nth 4 components))
	 (base-components (rng-uri-split base)))
    (if (and components
	     base-components
	     scheme
	     (equal scheme
		    (nth 0 base-components)))
	(progn
	  (setq scheme nil)
	  (when (and authority
		     (equal authority
			    (nth 1 base-components)))
	    (setq authority nil)
	    (setq path (rng-relative-path path (nth 2 base-components))))
	  (rng-uri-join scheme authority path query fragment-id))
      full)))