uri.collapse

function

Library: URI handling (OMURI)
Import : omuri.xmd

Returns: the resolved combination of all URIs


Declaration
export string function
   collapse read-only string URIs
  

Argument definitions

URIs
is a shelf containing URI strings to combine


Purpose

The function uri.collapse combines all given URIs into a single one. It is similar to uri.extend, but takes an arbitrary number of URIs and does not throw any exceptions. This function ignores all URIs shelf items that precede an absolute URI. If the last item in the shelf consists only of a URI fragment, it will be returned as the result.

In the following example, the function resolve-current-uri uses uri.collapse to combine all xml:base attributes specified in current elements into the current URI.

  import "omuri.xmd" prefixed by uri.
    
  define string function
     resolve-current-uri
  as
     local string URIs variable
  
     repeat over current elements as e
        set new URIs to attributes of current element e {"xml:base"}
           when attributes of current element e has key "xml:base"
     again
  
     return uri.collapse uris

Other Library Functions