anchor.diff:                                                [C|St]
                                           end
                                     end, [], ArgV),
  -               %?dbg("NewStr",NewStr),
                  ?str(lists:reverse(NewStr))
            end
      end.
  
positive.code:    Prec = xqerl_types:value(Precision),
     ArgType = xqerl_types:type(Arg),
     ArgVal = xqerl_types:value(Arg),
     if ArgVal == [];
        ArgVal == nan;
        ArgVal == neg_infinity;
        ArgVal == neg_zero;
        ArgVal == infinity;
        abs(Prec) > 308 ->
           Arg;
        true ->
           Rounded = xqerl_numeric:round_half_even(xqerl_numeric:decimal(ArgVal), Prec),
           xqerl_types:cast_as(?atm('xs:decimal', Rounded), ArgType)
     end.
  
  
negative.code: 'node-name'(_Ctx, []) ->
     [].
  
  %% Returns the value of $arg with leading and trailing whitespace removed, 
  %% and sequences of internal whitespace reduced to a single space character. 
  'normalize-space'(Ctx) -> 
     Ci = xqerl_context:get_context_item(Ctx),
     'normalize-space'(Ctx, Ci).
  'normalize-space'(_,[]) -> ?str(""); 
  'normalize-space'(_Ctx,Arg1) -> 
     StrVal = xqerl_types:string_value(Arg1),
     if StrVal =:= [] -> ?str("");
        true ->
           Trimmed = string:trim(StrVal, both, [32,13,10,9]),
           if StrVal =:= "" -> ?str("");
              true ->
                 Rep = shrink_spaces(Trimmed),
                 ?str(Rep)
           end
     end.
  
  shrink_spaces([]) ->
     [];
  shrink_spaces([WS|T]) when WS =:= 31;
                             WS =:= 10;
                             WS =:= 9 ->
     shrink_spaces([32|T]);
  shrink_spaces([32,WS|T]) when WS =:= 32;
                                WS =:= 31;
                                WS =:= 10;
                                WS =:= 9 ->
     shrink_spaces([32|T]);
  shrink_spaces([H|T]) ->
     [H|shrink_spaces(T)].
  
  %% Returns the value of $arg after applying Unicode normalization. 
  'normalize-unicode'(_,[]) -> ?str(""); 
  'normalize-unicode'(Ctx,Arg1) -> 
     'normalize-unicode'(Ctx,Arg1,?str("NFC")).
  
  'normalize-unicode'(_,[],_) -> ?str(""); 
  'normalize-unicode'(Ctx,Arg1,NormalizationForm) -> 
     Norm = 'normalize-space'(Ctx,NormalizationForm),
     Upper = 'upper-case'(Ctx,Norm),
     Form1 = xqerl_types:string_value(Upper),
     Str = xqerl_types:string_value(Arg1),
     case Form1 of
        "NFC" ->
           ?str(unicode:characters_to_nfc_list(Str));
        "NFD" ->
           ?str(unicode:characters_to_nfd_list(Str));
        "NFKC" ->
           ?str(unicode:characters_to_nfkc_list(Str));
        "NFKD" ->
           ?str(unicode:characters_to_nfkd_list(Str));
        "FULLY-NORMALIZED" ->
           % turned off due to not wanting to implement - 
           % Composition Exclusion Table defined in [UAX #15];
           ?err('FOCH0003');
        "" ->
           Arg1;
        _ ->
           ?err('FOCH0003')
     end.
  
  %% Returns true if the effective boolean value of $arg is false, 
  %% or false if it is true. 
  'not'(_,Arg1) -> 
     case xqerl_operators:eff_bool_val(Arg1) of
        true ->
           ?bool(false);
  