util/stanza.lua

changeset 4000
279a3f9f540c
parent 3999
257d13734d32
equal deleted inserted replaced
3999:257d13734d32 4000:279a3f9f540c
191 for k, v in pairs(t.attr) do 191 for k, v in pairs(t.attr) do
192 if s_find(k, "\1", 1, true) then 192 if s_find(k, "\1", 1, true) then
193 local ns, attrk = s_match(k, "^([^\1]*)\1?(.*)$"); 193 local ns, attrk = s_match(k, "^([^\1]*)\1?(.*)$");
194 nsid = nsid + 1; 194 nsid = nsid + 1;
195 t_insert(buf, " xmlns:ns"..nsid.."='"..xml_escape(ns).."' ".."ns"..nsid..":"..attrk.."='"..xml_escape(v).."'"); 195 t_insert(buf, " xmlns:ns"..nsid.."='"..xml_escape(ns).."' ".."ns"..nsid..":"..attrk.."='"..xml_escape(v).."'");
196 elseif not(k == "xmlns" and v == parentns) then 196 elseif not(k == "xmlns" and (v == parentns or not v)) then
197 t_insert(buf, " "..k.."='"..xml_escape(v).."'"); 197 t_insert(buf, " "..k.."='"..xml_escape(v).."'");
198 end 198 end
199 end 199 end
200 local len = #t; 200 local len = #t;
201 if len == 0 then 201 if len == 0 then

mercurial