-let tref_uref u =
- let s = str_uref u in
- MQueryTParser.ref MQueryTLexer.rtoken (Lexing.from_string s)
-
-(* implementazione manuale di tref_uref da controllare
-
-let split s =
- try
- let i = Str.search_forward (Str.regexp_string ":/") s 0 in
- let p = Str.string_before s i in
- let q = Str.string_after s (i + 2) in
- (p, q)
- with
- Not_found -> (s, "")
-
-let encode = function
- | Str.Text s -> MQBC s
- | Str.Delim s ->
- if s = "?" then MQBQ else
- if s = "*" then MQBS else
- if s = "**" then MQBSS else
- if s = "/" then MQBD else MQBC s
-
-let tref_uref (u, i) =
- let s = UriManager.string_of_uri u in
- match split s with
- | (p, q) ->
- let rx = Str.regexp "\?\|\*\*\|\*\|/" in
- let l = Str.full_split rx q in
- (Some p, List.map encode l, i)
-
-*)
-
-*)
+let string_of_uriref (uri, fi) =
+ let module UM = UriManager in
+ let str = UM.string_of_uri uri in
+ let xp t = "#xpointer(1/" ^ string_of_int (t + 1) in
+ match fi with
+ | [] -> str
+ | [t] -> str ^ xp t ^ ")"
+ | t :: c :: _ -> str ^ xp t ^ "/" ^ string_of_int c ^ ")"