anchor.diff:     encode_text(Tail,<<Acc/binary,"&amp;">>);
   encode_text(?CP_REST(H, Tail),Acc) when H == 16#0d ->
      encode_text(Tail,<<Acc/binary,"&#xD;">>);
  -encode_text(?CP_REST(H, Tail),Acc) when H >= 127 ->
  +encode_text(?CP_REST(H, Tail), Acc) when H >= 127 ->
      encode_text(Tail,<<Acc/binary,"&#x",(integer_to_binary(H,16))/binary,";">>);
   encode_text(?CP_REST(H, Tail),Acc) ->
      encode_text(Tail,<<Acc/binary,H/utf8>>).
  +
  +encode_html_text(Bin) -> 
  +   encode_html_text(Bin, <<>>).
  +
  +encode_html_text(<<>>,Acc) -> Acc;
  +encode_html_text(?STR_REST("\"",Tail),Acc) ->
  +   encode_html_text(Tail,<<Acc/binary,"&quot;">>);
  +encode_html_text(?STR_REST("'",Tail),Acc) ->
  +   encode_html_text(Tail,<<Acc/binary,"&apos;">>);
  +encode_html_text(?STR_REST("<",Tail),Acc) ->
  +   encode_html_text(Tail,<<Acc/binary,"&lt;">>);
  +encode_html_text(?STR_REST(">",Tail),Acc) ->
  +   encode_html_text(Tail,<<Acc/binary, "&gt;">>);
  +encode_html_text(?STR_REST("&", Tail),Acc) ->
  +   encode_html_text(Tail,<<Acc/binary,"&amp;">>);
  +encode_html_text(?CP_REST(H, Tail),Acc) when H == 16#0d ->
  +   encode_html_text(Tail,<<Acc/binary,"&#xD;">>);
  +encode_html_text(?CP_REST(H, Tail), Acc) when H >= 127 ->
  +   Ref = reference(H),
  +   encode_html_text(Tail,<<Acc/binary, Ref/binary>>);
  +encode_html_text(?CP_REST(H, Tail),Acc) ->
  +   encode_html_text(Tail,<<Acc/binary,H/utf8>>).
   
   encode_cdata(Txt) -> encode_cdata(Txt, <<"<![CDATA[">>).
   
  
positive.code:    <<"<!--", Txt/binary, "-->">>;
  do_serialize_xhtml(#{nk := text} = Node, _Opts, _) ->
     Txt = xqldb_mem_nodes:string_value(Node),
     encode_text(Txt);
  do_serialize_xhtml(#{nk := cdata} = Node, _Opts, _) ->
     Txt = xqldb_mem_nodes:string_value(Node),
     encode_cdata(Txt);
  do_serialize_xhtml(#{nk := attribute,
                       nn := NodeName} = Node, _Opts, _) ->
     Txt = xqldb_mem_nodes:string_value(Node),
  
negative.code:                  Node
             end,
     ChNds = xqldb_mem_nodes:children(Node1),
     Ch = if Ln == <<"script">>;
             Ln == <<"style">> ->
                lists:map(fun(#{nk := text} = Txt) ->
                                Txt#{nk := script};
                             (O) ->
                                O
                          end, ChNds);
             IsCdataNode ->
                lists:map(fun(#{nk := text} = Txt) ->
                                Txt#{nk := cdata};
                             (O) ->
  